//
// G5 Building
//

#include "stagesetup.h"

// Characters
#define CHR_CLOAK_1A          0x00 // first room
#define CHR_CLOAK_1B          0x01 // first room
#define CHR_LIGHTSWITCH_GUARD 0x02
#define CHR_CLOAK_2A          0x03 // second room
#define CHR_CLOAK_2B          0x04 // second room
#define CHR_CLOAK_2C          0x05 // second room
#define CHR_CLOAK_2D          0x06 // second room
#define CHR_CASS              0x18
#define CHR_TRENT             0x19
#define CHR_STRIPES           0x1a
#define CHR_BLONDE            0x1b
#define CHR_INTRO_VICTIM      0x1d

// Objects
#define OBJ_GENERATOR    0x01
#define OBJ_LASERSWITCH1 0x03
#define OBJ_LASERSWITCH2 0x04
#define OBJ_LASERSWITCH3 0x05
#define OBJ_LASERSWITCH4 0x06
#define OBJ_SAFEDOOR     0x0b
#define OBJ_BACKUPDISK   0x0c
#define OBJ_KEYCARD1     0x0e
#define OBJ_KEYCARD2     0x0f
#define OBJ_DECODER      0x10
#define OBJ_SAFEKEYPAD   0x11
#define OBJ_ALARM1       0x12
#define OBJ_ALARM2       0x13
#define OBJ_ESCAPEDOOR1  0x18
#define OBJ_ESCAPEDOOR2  0x1b
#define OBJ_LASER_1A     0x22
#define OBJ_LASER_1B     0x23
#define OBJ_LASER_1C     0x24
#define OBJ_LASER_1D     0x25
#define OBJ_LASER_2A     0x26
#define OBJ_LASER_2B     0x27
#define OBJ_LASER_2C     0x28
#define OBJ_LASER_2D     0x29
#define OBJ_LASER_3A     0x2a
#define OBJ_LASER_3B     0x2b
#define OBJ_LASER_3C     0x2c
#define OBJ_LASER_3D     0x2d
#define OBJ_LASER_4A     0x2e
#define OBJ_LASER_4B     0x2f
#define OBJ_LASER_4C     0x30
#define OBJ_LASER_4D     0x31
#define OBJ_MINE1        0x38
#define OBJ_MINE2        0x39
#define OBJ_NBOMB_CRATE  0x3c
#define OBJ_LIGHTSWITCH  0x3d
#define OBJ_CROSSBOW     0x3e
#define OBJ_CMP150_BOND  0x47
#define OBJ_CMP150_COOP  0x48
// Stage flags
#define STAGEFLAG_CLOAK1_ONE_REMAINING   0x00000002
#define STAGEFLAG_CLOAK2_ONE_REMAINING   0x00000004
#define STAGEFLAG_MEETING_FINISHED       0x00000008
#define STAGEFLAG_CONSPIRATORS_ALERTED   0x00000010
#define STAGEFLAG_VISITED_TOP_DOOR       0x00000020
#define STAGEFLAG_SAFEKEYPAD_DESTROYED   0x00000040
#define STAGEFLAG_LIGHTS_OFF             0x00000080
#define STAGEFLAG_GENERATOR_SHUT_DOWN    0x00000100
#define STAGEFLAG_GENERATOR_SHUT_DOWN2   0x00000200 // redundant
#define STAGEFLAG_GENERATOR_DESTROYED    0x00000400
#define STAGEFLAG_LASERSET1_DISABLED     0x00000800
#define STAGEFLAG_LASERSET2_DISABLED     0x00001000
#define STAGEFLAG_00002000               0x00002000
#define STAGEFLAG_LASERSET4_DISABLED     0x00004000
#define STAGEFLAG_LASERSWITCH1_DESTROYED 0x00008000
#define STAGEFLAG_LASERSWITCH2_DESTROYED 0x00010000
#define STAGEFLAG_LASERSWITCH3_DESTROYED 0x00020000
#define STAGEFLAG_LASERSWITCH4_DESTROYED 0x00040000
#define STAGEFLAG_ALL_LASERS_DISABLED    0x00080000
#define STAGEFLAG_DECODER_ATTACHED       0x00200000
#define STAGEFLAG_LASERSET3_DISABLED     0x00800000
#define STAGEFLAG_MEETING_STARTED        0x01000000
#define STAGEFLAG_BACKUP_COLLECTED       0x08000000
#define STAGEFLAG_MEETING_HOLOGRAPHED    0x10000000
#define STAGEFLAG_20000000               0x20000000
#define STAGEFLAG_ALARM_SOUNDING         0x40000000
#define STAGEFLAG_EXITED_BUILDING        0x80000000

// AI Lists
#define AILIST_WALK_FROM_MEETING 0x0403
#define AILIST_RUN_FROM_MEETING  0x0404
#define AILIST_CLOAK2_HIDE       0x0405
#define AILIST_INIT_TYPE1_GUARD  0x0406
#define AILIST_INIT_CLOAK1_GUARD 0x0408
#define AILIST_INTRO             0x040d
#define AILIST_MEETING_CUTSCENE  0x040e
#define AILIST_OUTRO             0x040f
#define AILIST_CLOAK_GUARD       0x0412
#define AILIST_CLOAK2_GUARD      0x0414

extern s32 intro[];
extern u32 props[];
extern struct path paths[];
extern struct ailist ailists[];

struct stagesetup setup = {
	NULL,
	NULL,
	NULL,
	intro,
	props,
	paths,
	ailists,
	NULL,
};

u32 props[] = {
	briefing(BRIEFINGTYPE_LOCATION, L_DEPO_001)
	briefing(BRIEFINGTYPE_TEXT_PA,  L_DEPO_000)
	briefing(BRIEFINGTYPE_TEXT_SA,  L_DEPO_002)
	briefing(BRIEFINGTYPE_TEXT_A,   L_DEPO_003)

	beginobjective(0, L_DEPO_009, (DIFFBIT_PA | DIFFBIT_PD)) // "Disable damping field generator"
		complete_flags(STAGEFLAG_GENERATOR_SHUT_DOWN)
		fail_flags(STAGEFLAG_GENERATOR_DESTROYED)
	endobjective

	beginobjective(1, L_DEPO_010, (DIFFBIT_SA | DIFFBIT_PA | DIFFBIT_PD)) // "Deactivate laser grid systems"
		complete_flags(STAGEFLAG_ALL_LASERS_DISABLED)
		complete_flags(STAGEFLAG_LASERSET1_DISABLED)
		complete_flags(STAGEFLAG_LASERSET2_DISABLED)
		complete_flags(STAGEFLAG_LASERSET3_DISABLED)
		complete_flags(STAGEFLAG_LASERSET4_DISABLED)
		fail_flags(STAGEFLAG_LASERSWITCH1_DESTROYED)
		fail_flags(STAGEFLAG_LASERSWITCH2_DESTROYED)
		fail_flags(STAGEFLAG_LASERSWITCH3_DESTROYED)
		fail_flags(STAGEFLAG_LASERSWITCH4_DESTROYED)
	endobjective

	beginobjective(2, L_DEPO_011, (DIFFBIT_A | DIFFBIT_SA | DIFFBIT_PA | DIFFBIT_PD)) // "Holograph meeting conspirators"
		complete_flags(STAGEFLAG_MEETING_HOLOGRAPHED)
		fail_flags(STAGEFLAG_20000000)
		fail_flags(STAGEFLAG_CONSPIRATORS_ALERTED)
		fail_flags(STAGEFLAG_00002000)
	endobjective

	beginobjective(3, L_DEPO_012, (DIFFBIT_A | DIFFBIT_SA | DIFFBIT_PA | DIFFBIT_PD)) // "Retrieve Dr. Caroll backup from safe"
		complete_flags(STAGEFLAG_BACKUP_COLLECTED)
		fail_flags(STAGEFLAG_SAFEKEYPAD_DESTROYED)
	endobjective

	beginobjective(4, L_DEPO_013, (DIFFBIT_A | DIFFBIT_SA | DIFFBIT_PA | DIFFBIT_PD)) // "Exit building"
		complete_flags(STAGEFLAG_EXITED_BUILDING)
	endobjective

	// First cloak room
	chr(SPAWNFLAG_IGNORECOLLISION, CHR_CLOAK_1A, PAD_DEPO_007E, BODY_G5_SWAT_GUARD, HEAD_RANDOM, GAILIST_IDLE, PAD_DEPO_007E, -1, 200, 100, CHRFLAG0_CAN_RETREAT | CHRFLAG0_SURPRISABLE, 0, TEAM_ENEMY, SQUADRON_01, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRCMP150, CHR_CLOAK_1A, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_CMP150)
	weapon(0x0100, MODEL_CHRCROSSBOW, CHR_CLOAK_1A, OBJFLAG_ASSIGNEDTOCHR | OBJFLAG_WEAPON_AICANNOTUSE, 0, 0, WEAPON_CROSSBOW)
	tag(OBJ_CROSSBOW, -1)

	chr(SPAWNFLAG_IGNORECOLLISION, CHR_CLOAK_1B, PAD_DEPO_007F, BODY_G5_SWAT_GUARD, HEAD_RANDOM, GAILIST_IDLE, PAD_DEPO_007F, -1, 200, 100, CHRFLAG0_CAN_RETREAT | CHRFLAG0_SURPRISABLE, 0, TEAM_ENEMY, SQUADRON_01, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRCMP150, CHR_CLOAK_1B, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_CMP150)

	tag(OBJ_KEYCARD1, 1)
	key(0x0080, MODEL_KEYCARD, CHR_CLOAK_1A, OBJFLAG_ASSIGNEDTOCHR, 0, 0, 4)
	rename_object(-1, WEAPON_KEYCARD45, L_DEPO_014, L_DEPO_015, L_DEPO_016, L_DEPO_017, L_DEPO_018) // "Obtain alpha key card."

	// Between cloak rooms
	chr(SPAWNFLAG_BASICGUARD | SPAWNFLAG_DONTSHOOTME | SPAWNFLAG_FIXEDHEIGHT, 0x02, PAD_DEPO_005F, BODY_G5_GUARD, HEAD_RANDOM, GAILIST_UNALERTED, PAD_DEPO_0080, -1, 2000, 100, CHRFLAG0_GP1 | CHRFLAG0_CAN_RETREAT | CHRFLAG0_00008000 | CHRFLAG0_CAN_TRAP | CHRFLAG0_CANLOSEGUN, CHRFLAG1_DOINGIDLEANIMATION, TEAM_NONCOMBAT, SQUADRON_04, -1, 0, 0, 1, 0, 0)
	weapon(0x0100, MODEL_CHRCMP150, 0x0002, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_CMP150)

	// Second cloak room
	chr(0, 0x03, PAD_DEPO_005E, BODY_G5_SWAT_GUARD, HEAD_RANDOM, AILIST_CLOAK2_HIDE, PAD_DEPO_006E, -1, 1, 15, CHRFLAG0_GP1 | CHRFLAG0_CAN_RETREAT | CHRFLAG0_00008000 | CHRFLAG0_CAN_TRAP | CHRFLAG0_SQUADALERTANYDIST, 0, TEAM_ENEMY, SQUADRON_02, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRCMP150, 0x0003, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_CMP150)

	chr(0, 0x04, PAD_DEPO_005D, BODY_G5_SWAT_GUARD, HEAD_RANDOM, AILIST_CLOAK2_HIDE, PAD_DEPO_006F, -1, 1, 15, CHRFLAG0_GP1 | CHRFLAG0_CAN_RETREAT | CHRFLAG0_00008000 | CHRFLAG0_CAN_TRAP | CHRFLAG0_SQUADALERTANYDIST, 0, TEAM_ENEMY, SQUADRON_02, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRCMP150, 0x0004, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_CMP150)

	chr(0, 0x05, PAD_DEPO_0072, BODY_G5_SWAT_GUARD, HEAD_RANDOM, AILIST_CLOAK2_HIDE, PAD_DEPO_0070, -1, 1, 10, CHRFLAG0_GP1 | CHRFLAG0_CAN_RETREAT | CHRFLAG0_00008000 | CHRFLAG0_CAN_TRAP | CHRFLAG0_SQUADALERTANYDIST, 0, TEAM_ENEMY, SQUADRON_02, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRCMP150, 0x0005, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_CMP150)

	chr(0, 0x06, PAD_DEPO_0013, BODY_G5_SWAT_GUARD, HEAD_RANDOM, AILIST_CLOAK2_HIDE, PAD_DEPO_0071, -1, 1, 10, CHRFLAG0_GP1 | CHRFLAG0_CAN_RETREAT | CHRFLAG0_00008000 | CHRFLAG0_CAN_TRAP | CHRFLAG0_SQUADALERTANYDIST, 0, TEAM_ENEMY, SQUADRON_02, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRCMP150, 0x0006, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_CMP150)

	tag(OBJ_KEYCARD2, 1)
	key(0x0080, MODEL_KEYCARD, 0x0003, OBJFLAG_ASSIGNEDTOCHR, 0, 0, 16)
	rename_object(-1, WEAPON_KEYCARD46, L_DEPO_019, L_DEPO_020, L_DEPO_021, L_DEPO_022, L_DEPO_023) // "Obtain alpha key card."

	// Rest of stage
	chr(SPAWNFLAG_BASICGUARD, 0x08, PAD_DEPO_002F, BODY_G5_GUARD, HEAD_RANDOM, AILIST_INIT_TYPE1_GUARD, PAD_DEPO_007B, -1, 200, 100, CHRFLAG0_GP1 | CHRFLAG0_CAN_RETREAT | CHRFLAG0_00008000 | CHRFLAG0_CAN_TRAP | CHRFLAG0_SQUADALERTANYDIST | CHRFLAG0_CANLOSEGUN, 0, TEAM_NONCOMBAT, SQUADRON_04, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRCMP150, 0x0008, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_CMP150)

	chr(SPAWNFLAG_IGNORECOLLISION | SPAWNFLAG_BASICGUARD, 0x09, PAD_DEPO_0079, BODY_G5_GUARD, HEAD_RANDOM, AILIST_INIT_TYPE1_GUARD, PAD_DEPO_007C, -1, 200, 100, CHRFLAG0_GP1 | CHRFLAG0_CAN_RETREAT | CHRFLAG0_00008000 | CHRFLAG0_CAN_TRAP | CHRFLAG0_SQUADALERTANYDIST | CHRFLAG0_CANLOSEGUN, 0, TEAM_NONCOMBAT, SQUADRON_04, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRCMP150, 0x0009, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_CMP150)

	chr(SPAWNFLAG_IGNORECOLLISION | SPAWNFLAG_BASICGUARD, 0x0a, PAD_DEPO_007A, BODY_G5_GUARD, HEAD_RANDOM, AILIST_INIT_TYPE1_GUARD, PAD_DEPO_007D, -1, 200, 100, CHRFLAG0_GP1 | CHRFLAG0_CAN_RETREAT | CHRFLAG0_00008000 | CHRFLAG0_CAN_TRAP | CHRFLAG0_SQUADALERTANYDIST | CHRFLAG0_CANLOSEGUN, 0, TEAM_NONCOMBAT, SQUADRON_04, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRCMP150, 0x000a, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_CMP150)

	chr(SPAWNFLAG_BASICGUARD, 0x0b, PAD_DEPO_0026, BODY_G5_GUARD, HEAD_RANDOM, 0x040c, PAD_DEPO_0029, -1, 100, 100, CHRFLAG0_GP1 | CHRFLAG0_CAN_RETREAT | CHRFLAG0_00008000 | CHRFLAG0_CAN_TRAP | CHRFLAG0_SQUADALERTANYDIST | CHRFLAG0_CANLOSEGUN, 0, TEAM_NONCOMBAT, SQUADRON_04, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRCMP150, 0x000b, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_CMP150)

	chr(SPAWNFLAG_BASICGUARD | SPAWNFLAG_ANTINONINTERACTABLE, 0x07, PAD_DEPO_005C, BODY_G5_GUARD, HEAD_BEAU1, 0x0409, -1, -1, 200, 100, CHRFLAG0_CANT_ALERT_GROUP | CHRFLAG0_CAN_RETREAT | CHRFLAG0_SURPRISABLE | CHRFLAG0_00008000 | CHRFLAG0_HEAR_REQUIRE_LOS | CHRFLAG0_CANLOSEGUN, 0, TEAM_NONCOMBAT, SQUADRON_05, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRCMP150, 0x0007, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_CMP150)

	chr(SPAWNFLAG_BASICGUARD | SPAWNFLAG_ANTINONINTERACTABLE, 0x0c, PAD_DEPO_005B, BODY_G5_GUARD, HEAD_RANDOM, AILIST_INIT_TYPE1_GUARD, PAD_DEPO_0073, -1, 200, 100, CHRFLAG0_CHUCKNORRIS | CHRFLAG0_CAN_RETREAT | CHRFLAG0_SURPRISABLE | CHRFLAG0_FORCESAFETYCHECKS | CHRFLAG0_00008000 | CHRFLAG0_HEAR_REQUIRE_LOS | CHRFLAG0_CANLOSEGUN, CHRFLAG1_LONG_CAMSPY_OBSERVATION, TEAM_NONCOMBAT, SQUADRON_05, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRCMP150, 0x000c, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_CMP150)

	chr(SPAWNFLAG_BASICGUARD | SPAWNFLAG_ANTINONINTERACTABLE, 0x0d, PAD_DEPO_001F, BODY_G5_GUARD, HEAD_RANDOM, AILIST_INIT_TYPE1_GUARD, PAD_DEPO_0073, -1, 200, 100, CHRFLAG0_CHUCKNORRIS | CHRFLAG0_CAN_RETREAT | CHRFLAG0_SURPRISABLE | CHRFLAG0_FORCESAFETYCHECKS | CHRFLAG0_00008000 | CHRFLAG0_HEAR_REQUIRE_LOS | CHRFLAG0_CANLOSEGUN, CHRFLAG1_LONG_CAMSPY_OBSERVATION, TEAM_NONCOMBAT, SQUADRON_05, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRCMP150, 0x000d, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_CMP150)

	chr(SPAWNFLAG_BASICGUARD | SPAWNFLAG_ANTINONINTERACTABLE, 0x0e, PAD_DEPO_0067, BODY_G5_GUARD, HEAD_RANDOM, 0x040a, PAD_DEPO_0073, -1, 200, 100, CHRFLAG0_CHUCKNORRIS | CHRFLAG0_CAN_RETREAT | CHRFLAG0_SURPRISABLE | CHRFLAG0_FORCESAFETYCHECKS | CHRFLAG0_00008000 | CHRFLAG0_HEAR_REQUIRE_LOS | CHRFLAG0_CANLOSEGUN, CHRFLAG1_LONG_CAMSPY_OBSERVATION, TEAM_NONCOMBAT, SQUADRON_05, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRCMP150, 0x000e, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_CMP150)

	chr(SPAWNFLAG_BASICGUARD | SPAWNFLAG_ANTINONINTERACTABLE, 0x0f, PAD_DEPO_0039, BODY_G5_GUARD, HEAD_RANDOM, AILIST_INIT_TYPE1_GUARD, PAD_DEPO_0074, -1, 200, 100, CHRFLAG0_CHUCKNORRIS | CHRFLAG0_FORCESAFETYCHECKS | CHRFLAG0_00008000 | CHRFLAG0_ACTIVATEALARM | CHRFLAG0_CANLOSEGUN, 0, TEAM_NONCOMBAT, SQUADRON_06, -1, 0, 2, 0, 7, 0)
	weapon(0x0100, MODEL_CHRCMP150, 0x000f, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_CMP150)

	chr(SPAWNFLAG_BASICGUARD | SPAWNFLAG_ANTINONINTERACTABLE, 0x10, PAD_DEPO_0068, BODY_G5_GUARD, HEAD_RANDOM, AILIST_INIT_TYPE1_GUARD, PAD_DEPO_0074, -1, 200, 100, CHRFLAG0_CHUCKNORRIS | CHRFLAG0_FORCESAFETYCHECKS | CHRFLAG0_00008000 | CHRFLAG0_ACTIVATEALARM | CHRFLAG0_CANLOSEGUN, 0, TEAM_NONCOMBAT, SQUADRON_06, -1, 0, 2, 0, 7, 0)
	weapon(0x0100, MODEL_CHRCMP150, 0x0010, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_CMP150)

	chr(SPAWNFLAG_BASICGUARD | SPAWNFLAG_ANTINONINTERACTABLE, 0x11, PAD_DEPO_0069, BODY_G5_GUARD, HEAD_RANDOM, AILIST_INIT_TYPE1_GUARD, PAD_DEPO_0074, -1, 200, 100, CHRFLAG0_CHUCKNORRIS | CHRFLAG0_FORCESAFETYCHECKS | CHRFLAG0_00008000 | CHRFLAG0_ACTIVATEALARM | CHRFLAG0_CANLOSEGUN, 0, TEAM_NONCOMBAT, SQUADRON_06, -1, 0, 2, 0, 7, 0)
	weapon(0x0100, MODEL_CHRCMP150, 0x0011, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_CMP150)

#if VERSION >= VERSION_PAL_BETA
	chr(SPAWNFLAG_BASICGUARD | SPAWNFLAG_ANTINONINTERACTABLE, 0x12, PAD_DEPO_003F, BODY_G5_GUARD, HEAD_RANDOM, 0x040b, -1, -1, 200, 100, CHRFLAG0_CHUCKNORRIS | CHRFLAG0_FORCESAFETYCHECKS | CHRFLAG0_00008000 | CHRFLAG0_CAN_HEAR_ALARMS | CHRFLAG0_CAN_HEARSPAWN | CHRFLAG0_CANLOSEGUN, 0, TEAM_NONCOMBAT, SQUADRON_06, -1, 0, 2, 0, 7, 0)
#else
	chr(SPAWNFLAG_BASICGUARD, 0x12, PAD_DEPO_003F, BODY_G5_GUARD, HEAD_RANDOM, 0x040b, -1, -1, 200, 100, CHRFLAG0_CHUCKNORRIS | CHRFLAG0_FORCESAFETYCHECKS | CHRFLAG0_00008000 | CHRFLAG0_CAN_HEAR_ALARMS | CHRFLAG0_CAN_HEARSPAWN | CHRFLAG0_CANLOSEGUN, 0, TEAM_NONCOMBAT, SQUADRON_06, -1, 0, 2, 0, 7, 0)
#endif
	weapon(0x0100, MODEL_CHRCMP150, 0x0012, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_CMP150)

#if VERSION >= VERSION_PAL_BETA
	chr(SPAWNFLAG_BASICGUARD | SPAWNFLAG_ANTINONINTERACTABLE, 0x13, PAD_DEPO_006A, BODY_G5_GUARD, HEAD_RANDOM, AILIST_INIT_TYPE1_GUARD, -1, -1, 200, 100, CHRFLAG0_CHUCKNORRIS | CHRFLAG0_FORCESAFETYCHECKS | CHRFLAG0_00008000 | CHRFLAG0_CAN_HEAR_ALARMS | CHRFLAG0_CAN_HEARSPAWN | CHRFLAG0_CANLOSEGUN, 0, TEAM_NONCOMBAT, SQUADRON_07, -1, 0, 0, 0, 0, 0)
#else
	chr(SPAWNFLAG_BASICGUARD, 0x13, PAD_DEPO_006A, BODY_G5_GUARD, HEAD_RANDOM, AILIST_INIT_TYPE1_GUARD, -1, -1, 200, 100, CHRFLAG0_CHUCKNORRIS | CHRFLAG0_FORCESAFETYCHECKS | CHRFLAG0_00008000 | CHRFLAG0_CAN_HEAR_ALARMS | CHRFLAG0_CAN_HEARSPAWN | CHRFLAG0_CANLOSEGUN, 0, TEAM_NONCOMBAT, SQUADRON_07, -1, 0, 0, 0, 0, 0)
#endif
	weapon(0x0100, MODEL_CHRCMP150, 0x0013, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_CMP150)

#if VERSION >= VERSION_PAL_BETA
	chr(SPAWNFLAG_BASICGUARD | SPAWNFLAG_ANTINONINTERACTABLE, 0x14, PAD_DEPO_006B, BODY_G5_GUARD, HEAD_RANDOM, AILIST_INIT_TYPE1_GUARD, -1, -1, 200, 100, CHRFLAG0_CHUCKNORRIS | CHRFLAG0_FORCESAFETYCHECKS | CHRFLAG0_00008000 | CHRFLAG0_HEAR_REQUIRE_LOS | CHRFLAG0_CANLOSEGUN, 0, TEAM_NONCOMBAT, SQUADRON_07, -1, 0, 0, 0, 0, 0)
#else
	chr(SPAWNFLAG_BASICGUARD, 0x14, PAD_DEPO_006B, BODY_G5_GUARD, HEAD_RANDOM, AILIST_INIT_TYPE1_GUARD, -1, -1, 200, 100, CHRFLAG0_CHUCKNORRIS | CHRFLAG0_FORCESAFETYCHECKS | CHRFLAG0_00008000 | CHRFLAG0_HEAR_REQUIRE_LOS | CHRFLAG0_CANLOSEGUN, 0, TEAM_NONCOMBAT, SQUADRON_07, -1, 0, 0, 0, 0, 0)
#endif
	weapon(0x0100, MODEL_CHRCMP150, 0x0014, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_CMP150)

#if VERSION >= VERSION_PAL_BETA
	chr(SPAWNFLAG_BASICGUARD | SPAWNFLAG_ANTINONINTERACTABLE, 0x15, PAD_DEPO_006C, BODY_G5_GUARD, HEAD_RANDOM, AILIST_INIT_TYPE1_GUARD, -1, -1, 200, 100, CHRFLAG0_CHUCKNORRIS | CHRFLAG0_FORCESAFETYCHECKS | CHRFLAG0_00008000 | CHRFLAG0_HEAR_REQUIRE_LOS | CHRFLAG0_CANLOSEGUN, 0, TEAM_NONCOMBAT, SQUADRON_07, -1, 0, 0, 0, 0, 0)
#else
	chr(SPAWNFLAG_BASICGUARD, 0x15, PAD_DEPO_006C, BODY_G5_GUARD, HEAD_RANDOM, AILIST_INIT_TYPE1_GUARD, -1, -1, 200, 100, CHRFLAG0_CHUCKNORRIS | CHRFLAG0_FORCESAFETYCHECKS | CHRFLAG0_00008000 | CHRFLAG0_HEAR_REQUIRE_LOS | CHRFLAG0_CANLOSEGUN, 0, TEAM_NONCOMBAT, SQUADRON_07, -1, 0, 0, 0, 0, 0)
#endif
	weapon(0x0100, MODEL_CHRCMP150, 0x0015, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_CMP150)

#if VERSION >= VERSION_PAL_BETA
	chr(SPAWNFLAG_BASICGUARD | SPAWNFLAG_ANTINONINTERACTABLE, 0x16, PAD_DEPO_006D, BODY_G5_GUARD, HEAD_RANDOM, AILIST_INIT_TYPE1_GUARD, -1, -1, 200, 100, CHRFLAG0_CHUCKNORRIS | CHRFLAG0_FORCESAFETYCHECKS | CHRFLAG0_00008000 | CHRFLAG0_HEAR_REQUIRE_LOS | CHRFLAG0_CANLOSEGUN, 0, TEAM_NONCOMBAT, SQUADRON_07, -1, 0, 0, 0, 0, 0)
#else
	chr(SPAWNFLAG_BASICGUARD, 0x16, PAD_DEPO_006D, BODY_G5_GUARD, HEAD_RANDOM, AILIST_INIT_TYPE1_GUARD, -1, -1, 200, 100, CHRFLAG0_CHUCKNORRIS | CHRFLAG0_FORCESAFETYCHECKS | CHRFLAG0_00008000 | CHRFLAG0_HEAR_REQUIRE_LOS | CHRFLAG0_CANLOSEGUN, 0, TEAM_NONCOMBAT, SQUADRON_07, -1, 0, 0, 0, 0, 0)
#endif
	weapon(0x0100, MODEL_CHRCMP150, 0x0016, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_CMP150)

	chr(SPAWNFLAG_BASICGUARD, 0x17, PAD_DEPO_0082, BODY_G5_GUARD, HEAD_RANDOM, AILIST_INIT_TYPE1_GUARD, -1, -1, 200, 100, CHRFLAG0_SKIPSAFETYCHECKS | CHRFLAG0_CAN_HEAR_ALARMS | CHRFLAG0_CAN_HEARSPAWN | CHRFLAG0_CANLOSEGUN, 0, TEAM_NONCOMBAT, SQUADRON_08, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRCMP150, 0x0017, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_CMP150)

	tag(0x0d, 1)
	chr(SPAWNFLAG_ANTINONINTERACTABLE, CHR_CASS, PAD_DEPO_0088, BODY_CASSANDRA, HEAD_CASSANDRA, 0x0410, -1, -1, 200, 100, CHRFLAG0_CHUCKNORRIS | CHRFLAG0_FORCESAFETYCHECKS | CHRFLAG0_00008000, 0, TEAM_ENEMY, SQUADRON_02, 0x4a, 0, 0, 1, 0, 0)
	chr(SPAWNFLAG_ANTINONINTERACTABLE, CHR_BLONDE, PAD_DEPO_0087, BODY_MRBLONDE, HEAD_MRBLONDE, 0x0410, -1, -1, 200, 100, CHRFLAG0_CHUCKNORRIS | CHRFLAG0_FORCESAFETYCHECKS | CHRFLAG0_00008000, 0, TEAM_ENEMY, SQUADRON_02, 0x4b, 0, 0, 1, 0, 0)
	chr(SPAWNFLAG_ANTINONINTERACTABLE, CHR_INTRO_VICTIM, PAD_DEPO_0009, BODY_G5_GUARD, HEAD_RANDOM, 0x0410, -1, -1, 1000, 100, CHRFLAG0_CAN_RETREAT | CHRFLAG0_FORCESAFETYCHECKS | CHRFLAG0_00008000, 0, TEAM_ENEMY, SQUADRON_08, -1, 0, 0, 0, 0, 0)
	weapon(0x0100, MODEL_CHRCMP150, CHR_INTRO_VICTIM, OBJFLAG_ASSIGNEDTOCHR, 0, 0, WEAPON_CMP150)
	chr(SPAWNFLAG_IGNORECOLLISION | SPAWNFLAG_ANTINONINTERACTABLE, CHR_TRENT, PAD_DEPO_003B, BODY_TRENT, HEAD_TRENT, 0x0411, -1, -1, 200, 100, CHRFLAG0_CHUCKNORRIS | CHRFLAG0_FORCESAFETYCHECKS | CHRFLAG0_00008000, 0, TEAM_ENEMY, SQUADRON_02, -1, 0, 0, 0, 0, 0)
	chr(SPAWNFLAG_IGNORECOLLISION | SPAWNFLAG_ANTINONINTERACTABLE, CHR_STRIPES, PAD_DEPO_003C, BODY_STRIPES, HEAD_JON, 0x0411, -1, -1, 200, 100, CHRFLAG0_CHUCKNORRIS | CHRFLAG0_FORCESAFETYCHECKS | CHRFLAG0_00008000, 0, TEAM_ENEMY, SQUADRON_02, -1, 0, 0, 0, 0, 0)
	tag(OBJ_GENERATOR, 1)
	multimonitor(0x0100, MODEL_PD_CONSOLE, PAD_DEPO_00D0, OBJFLAG_FALL | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_00000100, OBJFLAG2_IMMUNETOANTI, OBJFLAG3_INTERACTABLE, 1000, 3, 3, 0, 0)
	tag(0x3f, 1)
	door(0x0100, MODEL_DOOR2_G5, PAD_DEPO_009C, OBJFLAG_DEACTIVATED, OBJFLAG2_LOCKEDFRONT, 0, 1000, 0x0000e666, 0x00010000, 0x0001aaaa, 0x0001aaaa, 0x00000ccc, DOORFLAG_WINDOWED | DOORFLAG_0004, DOORTYPE_SLIDING, 0x00000010, 0x00000258, 0x012c0320, 0x00000001, 0x00000300)
	door(0x0100, MODEL_DOOR2_G5, PAD_DEPO_009D, OBJFLAG_DEACTIVATED, OBJFLAG2_LOCKEDBACK, 0, 1000, 0x0000e666, 0x00010000, 0x0001aaaa, 0x0001aaaa, 0x00000ccc, DOORFLAG_WINDOWED | DOORFLAG_0004, DOORTYPE_SLIDING, 0x00000010, 0x00000258, 0x012c0320, 0xffffffff, 0x00000000)
	tag(0x40, -1)
	door(0x0100, MODEL_DOOR2_G5, PAD_DEPO_00A2, OBJFLAG_DEACTIVATED, 0, 0, 1000, 0x0000e666, 0x00010000, 0x0001aaaa, 0x0001aaaa, 0x00000ccc, DOORFLAG_WINDOWED | DOORFLAG_0004, DOORTYPE_SLIDING, 0x00000000, 0x00000258, 0x012c0320, 0x00000001, 0x00000300)
	door(0x0100, MODEL_DOOR2_G5, PAD_DEPO_00A3, OBJFLAG_DEACTIVATED, 0, 0, 1000, 0x0000e666, 0x00010000, 0x0001aaaa, 0x0001aaaa, 0x00000ccc, DOORFLAG_WINDOWED | DOORFLAG_0004, DOORTYPE_SLIDING, 0x00000000, 0x00000258, 0x012c0320, 0xffffffff, 0x00000000)
	door(0x0100, MODEL_DOOR2_G5, PAD_DEPO_00A4, OBJFLAG_DEACTIVATED, 0, 0, 1000, 0x0000e666, 0x00010000, 0x0001aaaa, 0x0001aaaa, 0x00000ccc, DOORFLAG_WINDOWED | DOORFLAG_0004, DOORTYPE_SLIDING, 0x00000000, 0x00000258, 0x012c0320, 0x00000001, 0x00000300)
	door(0x0100, MODEL_DOOR2_G5, PAD_DEPO_00A5, OBJFLAG_DEACTIVATED, 0, 0, 1000, 0x0000e666, 0x00010000, 0x0001aaaa, 0x0001aaaa, 0x00000ccc, DOORFLAG_WINDOWED | DOORFLAG_0004, DOORTYPE_SLIDING, 0x00000000, 0x00000258, 0x012c0320, 0xffffffff, 0x00000000)
	door(0x0100, MODEL_DOOR2_G5, PAD_DEPO_00A6, OBJFLAG_DEACTIVATED, OBJFLAG2_INTERACTCHECKLOS | OBJFLAG2_LOCKEDFRONT, 0, 1000, 0x0000e666, 0x00010000, 0x0001aaaa, 0x0001aaaa, 0x00000ccc, DOORFLAG_WINDOWED | DOORFLAG_0004, DOORTYPE_SLIDING, 0x00000020, 0x00000258, 0x012c0320, 0x00000001, 0x00000300)
	door(0x0100, MODEL_DOOR2_G5, PAD_DEPO_00A7, OBJFLAG_DEACTIVATED, OBJFLAG2_INTERACTCHECKLOS | OBJFLAG2_LOCKEDBACK, 0, 1000, 0x0000e666, 0x00010000, 0x0001aaaa, 0x0001aaaa, 0x00000ccc, DOORFLAG_WINDOWED | DOORFLAG_0004, DOORTYPE_SLIDING, 0x00000020, 0x00000258, 0x012c0320, 0xffffffff, 0x00000000)
	door(0x0100, MODEL_DOOR2_G5, PAD_DEPO_00A8, OBJFLAG_DEACTIVATED, 0, 0, 1000, 0x0000e666, 0x00010000, 0x0001aaaa, 0x0001aaaa, 0x00000ccc, DOORFLAG_WINDOWED | DOORFLAG_0004, DOORTYPE_SLIDING, 0x00000000, 0x00000258, 0x012c0320, 0x00000001, 0x00000300)
	door(0x0100, MODEL_DOOR2_G5, PAD_DEPO_00A9, OBJFLAG_DEACTIVATED, 0, 0, 1000, 0x0000e666, 0x00010000, 0x0001aaaa, 0x0001aaaa, 0x00000ccc, DOORFLAG_WINDOWED | DOORFLAG_0004, DOORTYPE_SLIDING, 0x00000000, 0x00000258, 0x012c0320, 0xffffffff, 0x00000000)
	door(0x0100, MODEL_DOOR2_G5, PAD_DEPO_00B3, OBJFLAG_DEACTIVATED, 0, 0, 1000, 0x0000e666, 0x00010000, 0x0001aaaa, 0x0001aaaa, 0x00000ccc, DOORFLAG_WINDOWED | DOORFLAG_0004, DOORTYPE_SLIDING, 0x00000000, 0x00000258, 0x012c0320, 0x00000001, 0x00000300)
	door(0x0100, MODEL_DOOR2_G5, PAD_DEPO_00B4, OBJFLAG_DEACTIVATED, 0, 0, 1000, 0x0000e666, 0x00010000, 0x0001aaaa, 0x0001aaaa, 0x00000ccc, DOORFLAG_WINDOWED | DOORFLAG_0004, DOORTYPE_SLIDING, 0x00000000, 0x00000258, 0x012c0320, 0xffffffff, 0x00000000)
	door(0x0100, MODEL_DOOR2_G5, PAD_DEPO_00AA, OBJFLAG_DEACTIVATED, OBJFLAG2_INTERACTCHECKLOS | OBJFLAG2_LOCKEDFRONT | OBJFLAG2_AICANNOTUSE, 0, 1000, 0x0000e666, 0x00010000, 0x0001aaaa, 0x0001aaaa, 0x00000ccc, DOORFLAG_WINDOWED | DOORFLAG_0004, DOORTYPE_SLIDING, 0x00000020, 0x00000258, 0x012c0320, 0x00000001, 0x00000300)
	door(0x0100, MODEL_DOOR2_G5, PAD_DEPO_00AB, OBJFLAG_DEACTIVATED, OBJFLAG2_INTERACTCHECKLOS | OBJFLAG2_LOCKEDBACK | OBJFLAG2_AICANNOTUSE, 0, 1000, 0x0000e666, 0x00010000, 0x0001aaaa, 0x0001aaaa, 0x00000ccc, DOORFLAG_WINDOWED | DOORFLAG_0004, DOORTYPE_SLIDING, 0x00000020, 0x00000258, 0x012c0320, 0xffffffff, 0x00000000)
	door(0x0100, MODEL_DOOR2_G5, PAD_DEPO_00AC, OBJFLAG_DEACTIVATED, 0, 0, 1000, 0x0000e666, 0x00010000, 0x0001aaaa, 0x0001aaaa, 0x00000ccc, DOORFLAG_WINDOWED | DOORFLAG_0004, DOORTYPE_SLIDING, 0x00000000, 0x00000258, 0x012c0320, 0x00000001, 0x00000300)
	door(0x0100, MODEL_DOOR2_G5, PAD_DEPO_00AD, OBJFLAG_DEACTIVATED, 0, 0, 1000, 0x0000e666, 0x00010000, 0x0001aaaa, 0x0001aaaa, 0x00000ccc, DOORFLAG_WINDOWED | DOORFLAG_0004, DOORTYPE_SLIDING, 0x00000000, 0x00000258, 0x012c0320, 0xffffffff, 0x00000000)
	tag(0x34, 4)
	tag(0x35, 4)
	tag(0x36, 4)
	tag(0x37, 4)
	door(0x0100, MODEL_DOOR1A_G5, PAD_DEPO_0099, OBJFLAG_DEACTIVATED, OBJFLAG2_AICANNOTUSE, 0, 1000, 0x0000c000, 0x00010000, 0x00001999, 0x00014000, 0x00000666, 0, DOORTYPE_SLIDING, 0x00000004, 0x0000012c, 0x00000000, 0x00000001, 0x00001800)
	door(0x0100, MODEL_DOOR1ATRI_G5, PAD_DEPO_0098, OBJFLAG_DEACTIVATED, OBJFLAG2_AICANNOTUSE, 0, 1000, 0x0001f8ac, 0x0002a0e5, 0x0000434a, 0x0003491f, 0x000010d2, 0, DOORTYPE_SLIDING, 0x00000004, 0x0000012c, 0x00000000, 0x00000001, 0x00000000)
	door(0x0100, MODEL_DOOR1B_G5, PAD_DEPO_009A, OBJFLAG_DEACTIVATED, OBJFLAG2_AICANNOTUSE, 0, 1000, 0x0000c000, 0x00010000, 0x00001999, 0x00014000, 0x00000666, 0, DOORTYPE_SLIDING, 0x00000004, 0x0000012c, 0x00000000, 0x00000001, 0x00000000)
	door(0x0100, MODEL_DOOR1ATRI_G5, PAD_DEPO_009B, OBJFLAG_DEACTIVATED, OBJFLAG2_AICANNOTUSE, 0, 1000, 0x0001f8ac, 0x0002a0e5, 0x0000434a, 0x0003491f, 0x000010d2, 0, DOORTYPE_SLIDING, 0x00000004, 0x0000012c, 0x00000000, 0xfffffffd, 0x00000000)
	tag(0x33, 1)
	door(0x0100, MODEL_DOOR1A_G5, PAD_DEPO_00A0, OBJFLAG_DEACTIVATED, OBJFLAG2_AICANNOTUSE, 0, 1000, 0x0000c000, 0x00010000, 0x00001999, 0x00014000, 0x00000666, 0, DOORTYPE_SLIDING, 0x00000004, 0x0000012c, 0x00000000, 0x00000001, 0x00001800)
	door(0x0100, MODEL_DOOR1ATRI_G5, PAD_DEPO_00A1, OBJFLAG_DEACTIVATED, OBJFLAG2_AICANNOTUSE, 0, 1000, 0x0001f8ac, 0x0002a0e5, 0x0000434a, 0x0003491f, 0x000010d2, 0, DOORTYPE_SLIDING, 0x00000004, 0x0000012c, 0x00000000, 0x00000001, 0x00000000)
	door(0x0100, MODEL_DOOR1B_G5, PAD_DEPO_009F, OBJFLAG_DEACTIVATED, OBJFLAG2_AICANNOTUSE, 0, 1000, 0x0000c000, 0x00010000, 0x00001999, 0x00014000, 0x00000666, 0, DOORTYPE_SLIDING, 0x00000004, 0x0000012c, 0x00000000, 0x00000001, 0x00000000)
	door(0x0100, MODEL_DOOR1ATRI_G5, PAD_DEPO_009E, OBJFLAG_DEACTIVATED, OBJFLAG2_AICANNOTUSE, 0, 1000, 0x0001f8ac, 0x0002a0e5, 0x0000434a, 0x0003491f, 0x000010d2, 0, DOORTYPE_SLIDING, 0x00000004, 0x0000012c, 0x00000000, 0xfffffffd, 0x00000000)
	tag(0x43, -4)
	tag(0x44, -4)
	tag(0x45, -4)
	tag(0x46, -4)
	tag(0x3a, 1)
	door(0x0100, MODEL_DOOR4A_G5, PAD_DEPO_00B5, OBJFLAG_IGNOREFLOORCOLOUR, 0, OBJFLAG3_AUTOCUTSCENESOUNDS, 1000, 0x0000e666, 0x00010000, 0x0000ffff, 0x00014000, 0x00001999, 0, DOORTYPE_SLIDING, 0x00000000, 0x00000384, 0x00000000, 0x00000001, 0x00000300)
	door(0x0100, MODEL_DOOR4B_G5, PAD_DEPO_00B6, OBJFLAG_IGNOREFLOORCOLOUR, 0, 0, 1000, 0x0000e666, 0x00010000, 0x0000ffff, 0x00014000, 0x00001999, 0, DOORTYPE_SLIDING, 0x00000000, 0x00000384, 0x00000000, 0xffffffff, 0x00000000)
	tag(0x41, 1)
	door(0x0100, MODEL_G5CARLIFTDOOR, PAD_DEPO_00B7, 0, OBJFLAG2_AICANNOTUSE, 0, 1000, 0x0000e666, 0x00010000, 0x00001999, 0x00014000, 0x00000666, 0, DOORTYPE_SLIDING, 0x00000020, 0x00000384, 0x00000000, 0x00000001, 0x00000800)
	door(0x0100, MODEL_G5CARLIFTDOOR, PAD_DEPO_00B8, 0, OBJFLAG2_AICANNOTUSE, 0, 1000, 0x0000e666, 0x00010000, 0x00001999, 0x00014000, 0x00000666, DOORFLAG_FLIP, DOORTYPE_SLIDING, 0x00000020, 0x00000384, 0x00000000, 0xffffffff, 0x00000000)
	tag(0x42, -1)

	tag(OBJ_BACKUPDISK, 1)
#if VERSION >= VERSION_NTSC_1_0
	stdobject(0x0100, MODEL_ZIGGYCARD, PAD_DEPO_004C, OBJFLAG_00000008 | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_COLLECTABLE | OBJFLAG_BOUNCEIFSHOT | OBJFLAG_01000000, OBJFLAG2_IMMUNETOGUNFIRE, OBJFLAG3_ONSHELF, 1000)
#else
	stdobject(0x0100, MODEL_ZIGGYCARD, PAD_DEPO_1DF6B8A4, OBJFLAG_FALL | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_00000100 | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_COLLECTABLE | OBJFLAG_BOUNCEIFSHOT | OBJFLAG_01000000, OBJFLAG2_IMMUNETOGUNFIRE, OBJFLAG3_ONSHELF, 1000)
#endif
	rename_object(-1, WEAPON_BACKUPDISK, L_DEPO_030, L_DEPO_031, L_DEPO_032, L_DEPO_033, L_DEPO_034) // "Obtain DAT tape."

	tag(OBJ_DECODER, 1)
	stdobject(0x0200, MODEL_CHRDOORDECODER, PAD_DEPO_0050, OBJFLAG_00000008 | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_INVINCIBLE | OBJFLAG_FORCENOBOUNCE, OBJFLAG2_IMMUNETOANTI, 0, 1000)

	tag(OBJ_LIGHTSWITCH, 1)
	singlemonitor(0x0019, MODEL_G5_LASER_SWITCH, PAD_DEPO_00ED, OBJFLAG_00000002, 0, OBJFLAG3_INTERACTABLE, 1000, 6)
	tag(0x03, 1)
	singlemonitor(0x0019, MODEL_G5_LASER_SWITCH, PAD_DEPO_00E6, OBJFLAG_00000002, OBJFLAG2_IMMUNETOANTI, OBJFLAG3_INTERACTABLE, 1000, 19)
	tag(0x04, 1)
	singlemonitor(0x0019, MODEL_G5_LASER_SWITCH, PAD_DEPO_00E8, OBJFLAG_00000002, OBJFLAG2_IMMUNETOANTI, OBJFLAG3_INTERACTABLE, 1000, 19)
	tag(0x05, 1)
	singlemonitor(0x0019, MODEL_G5_LASER_SWITCH, PAD_DEPO_00E9, OBJFLAG_00000002, OBJFLAG2_IMMUNETOANTI, OBJFLAG3_INTERACTABLE, 1000, 19)
	tag(0x06, 1)
	singlemonitor(0x0019, MODEL_G5_LASER_SWITCH, PAD_DEPO_00EA, OBJFLAG_00000002, OBJFLAG2_IMMUNETOANTI, OBJFLAG3_INTERACTABLE, 1000, 19)
	tag(0x12, 1)
	singlemonitor(0x0019, MODEL_G5_ALARM, PAD_DEPO_00E7, OBJFLAG_00000002, OBJFLAG2_IMMUNETOGUNFIRE | OBJFLAG2_IMMUNETOEXPLOSIONS, OBJFLAG3_INTERACTABLE, 1000, 4)
	tag(0x13, 1)
	singlemonitor(0x0019, MODEL_G5_ALARM, PAD_DEPO_00EB, OBJFLAG_00000002, OBJFLAG2_IMMUNETOGUNFIRE | OBJFLAG2_IMMUNETOEXPLOSIONS, OBJFLAG3_INTERACTABLE, 1000, 4)
	tag(OBJ_SAFEKEYPAD, 1)
	singlemonitor(0x0019, MODEL_G5_LASER_SWITCH, PAD_DEPO_00EC, OBJFLAG_00000002, OBJFLAG2_IMMUNETOANTI, OBJFLAG3_INTERACTABLE, 1000, 1)
	tag(OBJ_SAFEDOOR, 1)
	door(0x0100, MODEL_G5SAFEDOOR, PAD_DEPO_00C2, OBJFLAG_00000010 | OBJFLAG_DEACTIVATED, OBJFLAG2_AICANNOTUSE, 0, 1000, 0x005a0000, 0x03e80000, 0x00500000, 0x00500000, 0x00001999, 0, DOORTYPE_SWINGING, 0x00000040, 0x00000e10, 0x00000000, 0x00000000, 0x00000300)

	tag(OBJ_CMP150_BOND, 1)
	weapon(0x0100, MODEL_CHRCMP150, -1, OBJFLAG_WEAPON_NOAMMO, 0, OBJFLAG3_PLAYERUNDROPPABLE, WEAPON_REMOTEMINE)
	rename_object(-1, WEAPON_REMOTEMINE, L_DEPO_066, L_DEPO_067, L_DEPO_068, L_DEPO_069, L_DEPO_070) // ""

	tag(OBJ_CMP150_COOP, 1)
	weapon(0x0100, MODEL_CHRCMP150, -1, OBJFLAG_WEAPON_NOAMMO, 0, OBJFLAG3_PLAYERUNDROPPABLE, WEAPON_REMOTEMINE)
	rename_object(-1, WEAPON_REMOTEMINE, L_DEPO_066, L_DEPO_067, L_DEPO_068, L_DEPO_069, L_DEPO_070) // ""

	glass(0x0100, MODEL_WINDOW, PAD_DEPO_00C0, OBJFLAG_00000002 | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_00000100 | OBJFLAG_ORTHOGONAL | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_PATHBLOCKER, OBJFLAG2_BULLETPROOF, 0, 1000)
	glass(0x0100, MODEL_WINDOW, PAD_DEPO_00C1, OBJFLAG_00000002 | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_00000100 | OBJFLAG_ORTHOGONAL | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_PATHBLOCKER, OBJFLAG2_BULLETPROOF, 0, 1000)
	glass(0x0100, MODEL_WINDOW, PAD_DEPO_00BE, OBJFLAG_00000002 | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_00000100 | OBJFLAG_ORTHOGONAL | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_PATHBLOCKER, OBJFLAG2_IMMUNETOGUNFIRE | OBJFLAG2_BULLETPROOF, 0, 1000)
	tag(0x22, 4)
	tag(0x23, 4)
	tag(0x24, 4)
	tag(0x25, 4)
	door(0x0100, MODEL_LASDOOR, PAD_DEPO_00D1, OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_CANNOT_ACTIVATE | OBJFLAG_AISEETHROUGH | OBJFLAG_DOOR_KEEPOPEN, OBJFLAG2_DONTPAUSE | OBJFLAG2_THROWTHROUGH, 0, 1000, 0x00011999, 0x00011999, 0x7fffffff, 0x7fffffff, 0x7fffffff, DOORFLAG_DAMAGEONCONTACT | DOORFLAG_UNBLOCKABLEOPEN, DOORTYPE_LASER, 0x00000000, 0x0000003c, 0x00000000, 0x00000000, 0x00000000)
	door(0x0100, MODEL_LASDOOR, PAD_DEPO_00D2, OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_CANNOT_ACTIVATE | OBJFLAG_AISEETHROUGH | OBJFLAG_DOOR_KEEPOPEN, OBJFLAG2_DONTPAUSE | OBJFLAG2_THROWTHROUGH, 0, 1000, 0x00011999, 0x00011999, 0x7fffffff, 0x7fffffff, 0x7fffffff, DOORFLAG_DAMAGEONCONTACT | DOORFLAG_UNBLOCKABLEOPEN, DOORTYPE_LASER, 0x00000000, 0x0000003c, 0x00000000, 0x00000000, 0x00000000)
	door(0x0100, MODEL_LASDOOR, PAD_DEPO_00D3, OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_CANNOT_ACTIVATE | OBJFLAG_AISEETHROUGH | OBJFLAG_DOOR_KEEPOPEN, OBJFLAG2_DONTPAUSE | OBJFLAG2_THROWTHROUGH, 0, 1000, 0x00011999, 0x00011999, 0x7fffffff, 0x7fffffff, 0x7fffffff, DOORFLAG_DAMAGEONCONTACT | DOORFLAG_UNBLOCKABLEOPEN, DOORTYPE_LASER, 0x00000000, 0x0000003c, 0x00000000, 0x00000000, 0x00000000)
	door(0x0100, MODEL_LASDOOR, PAD_DEPO_00D4, OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_CANNOT_ACTIVATE | OBJFLAG_AISEETHROUGH | OBJFLAG_DOOR_KEEPOPEN, OBJFLAG2_DONTPAUSE | OBJFLAG2_THROWTHROUGH, 0, 1000, 0x00011999, 0x00011999, 0x7fffffff, 0x7fffffff, 0x7fffffff, DOORFLAG_DAMAGEONCONTACT | DOORFLAG_UNBLOCKABLEOPEN, DOORTYPE_LASER, 0x00000000, 0x0000003c, 0x00000000, 0x00000000, 0x00000000)
	tag(0x26, 4)
	tag(0x27, 4)
	tag(0x28, 4)
	tag(0x29, 4)
	door(0x0100, MODEL_LASDOOR, PAD_DEPO_00D5, OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_CANNOT_ACTIVATE | OBJFLAG_AISEETHROUGH | OBJFLAG_DOOR_KEEPOPEN, OBJFLAG2_DONTPAUSE | OBJFLAG2_THROWTHROUGH, 0, 1000, 0x00011999, 0x00011999, 0x7fffffff, 0x7fffffff, 0x7fffffff, DOORFLAG_DAMAGEONCONTACT | DOORFLAG_UNBLOCKABLEOPEN, DOORTYPE_LASER, 0x00000000, 0x0000003c, 0x00000000, 0x00000000, 0x00000000)
	door(0x0100, MODEL_LASDOOR, PAD_DEPO_00D6, OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_CANNOT_ACTIVATE | OBJFLAG_AISEETHROUGH | OBJFLAG_DOOR_KEEPOPEN, OBJFLAG2_DONTPAUSE | OBJFLAG2_THROWTHROUGH, 0, 1000, 0x00011999, 0x00011999, 0x7fffffff, 0x7fffffff, 0x7fffffff, DOORFLAG_DAMAGEONCONTACT | DOORFLAG_UNBLOCKABLEOPEN, DOORTYPE_LASER, 0x00000000, 0x0000003c, 0x00000000, 0x00000000, 0x00000000)
	door(0x0100, MODEL_LASDOOR, PAD_DEPO_00D7, OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_CANNOT_ACTIVATE | OBJFLAG_AISEETHROUGH | OBJFLAG_DOOR_KEEPOPEN, OBJFLAG2_DONTPAUSE | OBJFLAG2_THROWTHROUGH, 0, 1000, 0x00011999, 0x00011999, 0x7fffffff, 0x7fffffff, 0x7fffffff, DOORFLAG_DAMAGEONCONTACT | DOORFLAG_UNBLOCKABLEOPEN, DOORTYPE_LASER, 0x00000000, 0x0000003c, 0x00000000, 0x00000000, 0x00000000)
	door(0x0100, MODEL_LASDOOR, PAD_DEPO_00D8, OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_CANNOT_ACTIVATE | OBJFLAG_AISEETHROUGH | OBJFLAG_DOOR_KEEPOPEN, OBJFLAG2_DONTPAUSE | OBJFLAG2_THROWTHROUGH, 0, 1000, 0x00011999, 0x00011999, 0x7fffffff, 0x7fffffff, 0x7fffffff, DOORFLAG_DAMAGEONCONTACT | DOORFLAG_UNBLOCKABLEOPEN, DOORTYPE_LASER, 0x00000000, 0x0000003c, 0x00000000, 0x00000000, 0x00000000)
	tag(0x2a, 4)
	tag(0x2b, 4)
	tag(0x2c, 4)
	tag(0x2d, 4)
	door(0x0100, MODEL_LASDOOR, PAD_DEPO_00D9, OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_CANNOT_ACTIVATE | OBJFLAG_AISEETHROUGH | OBJFLAG_DOOR_KEEPOPEN, OBJFLAG2_DONTPAUSE | OBJFLAG2_THROWTHROUGH, 0, 1000, 0x00011999, 0x00011999, 0x7fffffff, 0x7fffffff, 0x7fffffff, DOORFLAG_DAMAGEONCONTACT | DOORFLAG_UNBLOCKABLEOPEN, DOORTYPE_LASER, 0x00000000, 0x0000003c, 0x00000000, 0x00000000, 0x00000000)
	door(0x0100, MODEL_LASDOOR, PAD_DEPO_00DA, OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_CANNOT_ACTIVATE | OBJFLAG_AISEETHROUGH | OBJFLAG_DOOR_KEEPOPEN, OBJFLAG2_DONTPAUSE | OBJFLAG2_THROWTHROUGH, 0, 1000, 0x00011999, 0x00011999, 0x7fffffff, 0x7fffffff, 0x7fffffff, DOORFLAG_DAMAGEONCONTACT | DOORFLAG_UNBLOCKABLEOPEN, DOORTYPE_LASER, 0x00000000, 0x0000003c, 0x00000000, 0x00000000, 0x00000000)
	door(0x0100, MODEL_LASDOOR, PAD_DEPO_00DB, OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_CANNOT_ACTIVATE | OBJFLAG_AISEETHROUGH | OBJFLAG_DOOR_KEEPOPEN, OBJFLAG2_DONTPAUSE | OBJFLAG2_THROWTHROUGH, 0, 1000, 0x00011999, 0x00011999, 0x7fffffff, 0x7fffffff, 0x7fffffff, DOORFLAG_DAMAGEONCONTACT | DOORFLAG_UNBLOCKABLEOPEN, DOORTYPE_LASER, 0x00000000, 0x0000003c, 0x00000000, 0x00000000, 0x00000000)
	door(0x0100, MODEL_LASDOOR, PAD_DEPO_00DC, OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_CANNOT_ACTIVATE | OBJFLAG_AISEETHROUGH | OBJFLAG_DOOR_KEEPOPEN, OBJFLAG2_DONTPAUSE | OBJFLAG2_THROWTHROUGH, 0, 1000, 0x00011999, 0x00011999, 0x7fffffff, 0x7fffffff, 0x7fffffff, DOORFLAG_DAMAGEONCONTACT | DOORFLAG_UNBLOCKABLEOPEN, DOORTYPE_LASER, 0x00000000, 0x0000003c, 0x00000000, 0x00000000, 0x00000000)
	tag(0x2e, 4)
	tag(0x2f, 4)
	tag(0x30, 4)
	tag(0x31, 4)
	door(0x0100, MODEL_LASDOOR, PAD_DEPO_00DD, OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_CANNOT_ACTIVATE | OBJFLAG_AISEETHROUGH | OBJFLAG_DOOR_KEEPOPEN, OBJFLAG2_DONTPAUSE | OBJFLAG2_THROWTHROUGH, 0, 1000, 0x00011999, 0x00011999, 0x7fffffff, 0x7fffffff, 0x7fffffff, DOORFLAG_DAMAGEONCONTACT | DOORFLAG_UNBLOCKABLEOPEN, DOORTYPE_LASER, 0x00000000, 0x0000003c, 0x00000000, 0x00000001, 0x00000000)
	door(0x0100, MODEL_LASDOOR, PAD_DEPO_00DE, OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_CANNOT_ACTIVATE | OBJFLAG_AISEETHROUGH | OBJFLAG_DOOR_KEEPOPEN, OBJFLAG2_DONTPAUSE | OBJFLAG2_THROWTHROUGH, 0, 1000, 0x00011999, 0x00011999, 0x7fffffff, 0x7fffffff, 0x7fffffff, DOORFLAG_DAMAGEONCONTACT | DOORFLAG_UNBLOCKABLEOPEN, DOORTYPE_LASER, 0x00000000, 0x0000003c, 0x00000000, 0x00000001, 0x00000000)
	door(0x0100, MODEL_LASDOOR, PAD_DEPO_00DF, OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_CANNOT_ACTIVATE | OBJFLAG_AISEETHROUGH | OBJFLAG_DOOR_KEEPOPEN, OBJFLAG2_DONTPAUSE | OBJFLAG2_THROWTHROUGH, 0, 1000, 0x00011999, 0x00011999, 0x7fffffff, 0x7fffffff, 0x7fffffff, DOORFLAG_DAMAGEONCONTACT | DOORFLAG_UNBLOCKABLEOPEN, DOORTYPE_LASER, 0x00000000, 0x0000003c, 0x00000000, 0x00000001, 0x00000000)
	door(0x0100, MODEL_LASDOOR, PAD_DEPO_00E0, OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_CANNOT_ACTIVATE | OBJFLAG_AISEETHROUGH | OBJFLAG_DOOR_KEEPOPEN, OBJFLAG2_DONTPAUSE | OBJFLAG2_THROWTHROUGH, 0, 1000, 0x00011999, 0x00011999, 0x7fffffff, 0x7fffffff, 0x7fffffff, DOORFLAG_DAMAGEONCONTACT | DOORFLAG_UNBLOCKABLEOPEN, DOORTYPE_LASER, 0x00000000, 0x0000003c, 0x00000000, 0xfffffffd, 0x00000000)
	tag(OBJ_ESCAPEDOOR1, 2)
	conditional_scenery(1, 0, 2)
	door(0x0100, MODEL_G5_ESCDOORUP, PAD_DEPO_00F0, OBJFLAG_00000100 | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_PATHBLOCKER | OBJFLAG_UNCOLLECTABLE | OBJFLAG_FORCENOBOUNCE | OBJFLAG_01000000 | OBJFLAG_CANNOT_ACTIVATE | OBJFLAG_DEACTIVATED, OBJFLAG2_NOFALL | OBJFLAG2_FALLWITHOUTROTATION | OBJFLAG2_IMMUNETOGUNFIRE | OBJFLAG2_BULLETPROOF | OBJFLAG2_IMMUNETOEXPLOSIONS | OBJFLAG2_AICANNOTUSE, 0, 1000, 0x00000000, 0x00010000, 0x03e80000, 0x03e80000, 0x00010000, 0, DOORTYPE_SLIDING, 0x00000080, 0x00000001, 0x00010000, 0x00000000, 0x00000000)
#if VERSION >= VERSION_NTSC_1_0
	stdobject(0x0100, MODEL_G5_ESCDOORUPBOOM, PAD_DEPO_00F1, OBJFLAG_00000008 | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_INVINCIBLE | OBJFLAG_UNCOLLECTABLE | OBJFLAG_FORCENOBOUNCE | OBJFLAG_01000000 | OBJFLAG_CANNOT_ACTIVATE, OBJFLAG2_NOFALL | OBJFLAG2_FALLWITHOUTROTATION | OBJFLAG2_IMMUNETOGUNFIRE | OBJFLAG2_BULLETPROOF | OBJFLAG2_IMMUNETOEXPLOSIONS, 0, 1000)
#else
	stdobject(0x0100, MODEL_G5_ESCDOORUPBOOM, PAD_DEPO_00F1, OBJFLAG_00000008 | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_UNCOLLECTABLE | OBJFLAG_FORCENOBOUNCE | OBJFLAG_01000000 | OBJFLAG_CANNOT_ACTIVATE, OBJFLAG2_NOFALL | OBJFLAG2_FALLWITHOUTROTATION | OBJFLAG2_IMMUNETOGUNFIRE | OBJFLAG2_BULLETPROOF | OBJFLAG2_IMMUNETOEXPLOSIONS, 0, 1000)
#endif
	tag(OBJ_ESCAPEDOOR2, 2)
	conditional_scenery(1, 0, 2)
	door(0x0100, MODEL_G5_ESCDOORDOWN, PAD_DEPO_00EE, OBJFLAG_00000100 | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_PATHBLOCKER | OBJFLAG_UNCOLLECTABLE | OBJFLAG_FORCENOBOUNCE | OBJFLAG_01000000 | OBJFLAG_CANNOT_ACTIVATE | OBJFLAG_DEACTIVATED, OBJFLAG2_NOFALL | OBJFLAG2_FALLWITHOUTROTATION | OBJFLAG2_IMMUNETOGUNFIRE | OBJFLAG2_BULLETPROOF | OBJFLAG2_IMMUNETOEXPLOSIONS | OBJFLAG2_AICANNOTUSE, 0, 1000, 0x00000000, 0x00010000, 0x03e80000, 0x03e80000, 0x00010000, 0, DOORTYPE_SLIDING, 0x00000080, 0x00000001, 0x00010000, 0x00000000, 0x00000000)
#if VERSION >= VERSION_NTSC_1_0
	stdobject(0x0100, MODEL_G5_ESCDOORDOWNBOOM, PAD_DEPO_00EF, OBJFLAG_00000008 | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_INVINCIBLE | OBJFLAG_UNCOLLECTABLE | OBJFLAG_FORCENOBOUNCE | OBJFLAG_01000000 | OBJFLAG_CANNOT_ACTIVATE, OBJFLAG2_NOFALL | OBJFLAG2_FALLWITHOUTROTATION | OBJFLAG2_IMMUNETOGUNFIRE | OBJFLAG2_BULLETPROOF | OBJFLAG2_IMMUNETOEXPLOSIONS, 0, 1000)
#else
	stdobject(0x0100, MODEL_G5_ESCDOORDOWNBOOM, PAD_DEPO_00EF, OBJFLAG_00000008 | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_IGNOREFLOORCOLOUR | OBJFLAG_UNCOLLECTABLE | OBJFLAG_FORCENOBOUNCE | OBJFLAG_01000000 | OBJFLAG_CANNOT_ACTIVATE, OBJFLAG2_NOFALL | OBJFLAG2_FALLWITHOUTROTATION | OBJFLAG2_IMMUNETOGUNFIRE | OBJFLAG2_BULLETPROOF | OBJFLAG2_IMMUNETOEXPLOSIONS, 0, 1000)
#endif

	tag(OBJ_MINE1, 1)
	mine(0x0100, MODEL_CHRREMOTEMINE, PAD_DEPO_0077, OBJFLAG_00000002, 0, 0, 1000, WEAPON_REMOTEMINE)

	tag(OBJ_MINE2, 1)
	mine(0x0100, MODEL_CHRREMOTEMINE, PAD_DEPO_0078, OBJFLAG_00000002, 0, 0, 1000, WEAPON_REMOTEMINE)

	stdobject(0x0100, MODEL_DUMPSTER, PAD_DEPO_00F9, OBJFLAG_FALL | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_00000100 | OBJFLAG_INVINCIBLE, 0, 0, 1000)
	stdobject(0x0100, MODEL_DUMPSTER, PAD_DEPO_00FA, OBJFLAG_FALL | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_00000100 | OBJFLAG_INVINCIBLE, 0, 0, 1000)
	stdobject(0x0100, MODEL_DUMPSTER, PAD_DEPO_00FB, OBJFLAG_FALL | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_00000100 | OBJFLAG_INVINCIBLE, 0, 0, 1000)
	stdobject(0x0100, MODEL_DUMPSTER, PAD_DEPO_00FC, OBJFLAG_FALL | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_00000100 | OBJFLAG_INVINCIBLE, 0, 0, 1000)
#if VERSION >= VERSION_NTSC_1_0
	stdobject(0x0028, MODEL_BAFTA, PAD_DEPO_004D, OBJFLAG_00000008 | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_BOUNCEIFSHOT, 0, 0, 1000)
#else
	stdobject(0x0028, MODEL_BAFTA, PAD_DEPO_2B94077E, OBJFLAG_FALL | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_00000100 | OBJFLAG_BOUNCEIFSHOT, 0, 0, 1000)
#endif
	stdobject(0x0133, MODEL_G5SMALLCHAIR, PAD_DEPO_00F3, OBJFLAG_FALL | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_00000100 | OBJFLAG_IGNOREFLOORCOLOUR, 0, OBJFLAG3_PUSHABLE, 1000)
	stdobject(0x0133, MODEL_G5SMALLCHAIR, PAD_DEPO_00F4, OBJFLAG_FALL | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_00000100 | OBJFLAG_IGNOREFLOORCOLOUR, 0, OBJFLAG3_PUSHABLE, 1000)
	stdobject(0x0133, MODEL_G5SMALLCHAIR, PAD_DEPO_00F5, OBJFLAG_FALL | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_00000100 | OBJFLAG_IGNOREFLOORCOLOUR, 0, OBJFLAG3_PUSHABLE, 1000)
	stdobject(0x0133, MODEL_G5SMALLCHAIR, PAD_DEPO_00F6, OBJFLAG_FALL | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_00000100 | OBJFLAG_IGNOREFLOORCOLOUR, 0, OBJFLAG3_PUSHABLE, 1000)
	stdobject(0x0133, MODEL_G5SMALLCHAIR, PAD_DEPO_00F7, OBJFLAG_FALL | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_00000100 | OBJFLAG_IGNOREFLOORCOLOUR, 0, OBJFLAG3_PUSHABLE, 1000)
	tag(0x4a, 1)
	stdobject(0x0185, MODEL_G5BIGCHAIR, PAD_DEPO_00F8, OBJFLAG_FALL | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_IGNOREFLOORCOLOUR, 0, OBJFLAG3_PUSHABLE, 1000)
	tag(0x4b, 1)
	stdobject(0x0133, MODEL_G5SMALLCHAIR, PAD_DEPO_00F2, OBJFLAG_FALL | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_IGNOREFLOORCOLOUR, 0, OBJFLAG3_PUSHABLE, 1000)
	stdobject(0x0100, MODEL_G5_MAINFRAME, PAD_DEPO_00C8, OBJFLAG_FALL | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_00000100 | OBJFLAG_IGNOREFLOORCOLOUR, OBJFLAG2_IMMUNETOANTI, OBJFLAG3_PUSHABLE, 500)
	stdobject(0x0100, MODEL_G5_MAINFRAME, PAD_DEPO_00C9, OBJFLAG_FALL | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_00000100 | OBJFLAG_IGNOREFLOORCOLOUR, OBJFLAG2_IMMUNETOANTI, OBJFLAG3_PUSHABLE, 500)
	stdobject(0x0100, MODEL_G5_MAINFRAME, PAD_DEPO_00CA, OBJFLAG_FALL | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_00000100 | OBJFLAG_IGNOREFLOORCOLOUR, OBJFLAG2_IMMUNETOANTI, OBJFLAG3_PUSHABLE, 500)
	stdobject(0x0100, MODEL_G5_MAINFRAME, PAD_DEPO_00CB, OBJFLAG_FALL | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_00000100 | OBJFLAG_IGNOREFLOORCOLOUR, OBJFLAG2_IMMUNETOANTI, OBJFLAG3_PUSHABLE, 500)
	stdobject(0x0100, MODEL_G5_MAINFRAME, PAD_DEPO_00CC, OBJFLAG_FALL | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_00000100 | OBJFLAG_IGNOREFLOORCOLOUR, OBJFLAG2_IMMUNETOANTI, OBJFLAG3_PUSHABLE, 500)
	stdobject(0x0100, MODEL_G5_MAINFRAME, PAD_DEPO_00CD, OBJFLAG_FALL | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_00000100 | OBJFLAG_IGNOREFLOORCOLOUR, OBJFLAG2_IMMUNETOANTI, OBJFLAG3_PUSHABLE, 500)
	stdobject(0x0100, MODEL_G5_MAINFRAME, PAD_DEPO_00CE, OBJFLAG_FALL | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_00000100 | OBJFLAG_IGNOREFLOORCOLOUR, OBJFLAG2_IMMUNETOANTI, OBJFLAG3_PUSHABLE, 500)
	stdobject(0x0100, MODEL_G5_MAINFRAME, PAD_DEPO_00CF, OBJFLAG_FALL | OBJFLAG_XTOPADBOUNDS | OBJFLAG_YTOPADBOUNDS | OBJFLAG_ZTOPADBOUNDS | OBJFLAG_00000100 | OBJFLAG_IGNOREFLOORCOLOUR, OBJFLAG2_IMMUNETOANTI, OBJFLAG3_PUSHABLE, 500)

	tag(0x3c, 1)
	weapon(0x0080, MODEL_MULTI_AMMO_CRATE, PAD_DEPO_0095, OBJFLAG_FALL | OBJFLAG_00000100, 0, 0, WEAPON_NBOMB)

	tag(0x3b, 1)
	shield(0x0100, MODEL_CHRSHIELD, PAD_DEPO_0096, OBJFLAG_FALL, OBJFLAG2_EXCLUDE_SA | OBJFLAG2_EXCLUDE_PA | OBJFLAG2_EXCLUDE_PD, 0, 1000)
	tag(0x49, 1)
	shield(0x0100, MODEL_CHRSHIELD, PAD_DEPO_0056, OBJFLAG_FALL, OBJFLAG2_EXCLUDE_PA | OBJFLAG2_EXCLUDE_PD, 0, 1000)
	endprops
};

s32 intro[] = {
	intro_weapon(WEAPON_FALCON2_SILENCER, -1)
	ammo(AMMOTYPE_PISTOL, 100)
	ammo(AMMOTYPE_NBOMB, 6)
	outfit(OUTFIT_LEATHER)
	intro_weapon(WEAPON_DOORDECODER, -1)
	intro_weapon(WEAPON_EYESPY, -1)
	spawn(PAD_DEPO_0083)
	endintro
};

s32 path00[] = {
	PAD_DEPO_0015,
	PAD_DEPO_0014,
	PAD_DEPO_0019,
	PAD_DEPO_0018,
	PAD_DEPO_0019,
	PAD_DEPO_0014,
	-1,
};

s32 path01[] = {
	PAD_DEPO_0023,
	PAD_DEPO_0025,
	PAD_DEPO_0020,
	PAD_DEPO_001A,
	PAD_DEPO_001C,
	PAD_DEPO_001A,
	PAD_DEPO_0020,
	PAD_DEPO_0025,
	-1,
};

s32 path02[] = {
	PAD_DEPO_0037,
	PAD_DEPO_003F,
	PAD_DEPO_0043,
	PAD_DEPO_0041,
	PAD_DEPO_0040,
	PAD_DEPO_0042,
	PAD_DEPO_0045,
	PAD_DEPO_0046,
	PAD_DEPO_0045,
	PAD_DEPO_0042,
	PAD_DEPO_0040,
	PAD_DEPO_0041,
	PAD_DEPO_0043,
	PAD_DEPO_003F,
	-1,
};

s32 path03[] = {
	PAD_DEPO_0027,
	PAD_DEPO_0028,
	PAD_DEPO_0029,
	PAD_DEPO_002A,
	PAD_DEPO_002D,
	PAD_DEPO_002E,
	PAD_DEPO_002D,
	PAD_DEPO_002A,
	PAD_DEPO_0029,
	PAD_DEPO_0028,
	PAD_DEPO_0027,
	PAD_DEPO_0026,
	-1,
};

u8 func0409_start_path00[] = {
	set_chr_dodge_rating(2, 10)
	set_accuracy(5)
	set_reaction_speed(30)
	set_chr_maxdamage(CHR_SELF, 40)
	add_health_or_armor(0)
	set_recovery_speed(0)
	set_shield(0)
	assign_path(0)
	start_patrol
	set_ailist(CHR_SELF, GAILIST_UNALERTED_0004)
	endlist
};

u8 func040a_start_path01[] = {
	set_chr_dodge_rating(2, 10)
	set_accuracy(5)
	set_reaction_speed(30)
	set_chr_maxdamage(CHR_SELF, 40)
	add_health_or_armor(0)
	set_recovery_speed(0)
	set_shield(0)
	assign_path(1)
	start_patrol
	set_ailist(CHR_SELF, GAILIST_UNALERTED_0004)
	endlist
};

u8 func040b_start_path02[] = {
	set_chr_dodge_rating(2, 10)
	set_accuracy(5)
	set_reaction_speed(30)
	set_chr_maxdamage(CHR_SELF, 40)
	add_health_or_armor(0)
	set_recovery_speed(0)
	set_shield(0)
	assign_path(2)
	start_patrol
	set_ailist(CHR_SELF, GAILIST_UNALERTED_0004)
	endlist
};

u8 func040c_start_path03[] = {
	set_chr_dodge_rating(2, 10)
	set_accuracy(5)
	set_reaction_speed(30)
	set_chr_maxdamage(CHR_SELF, 40)
	add_health_or_armor(0)
	set_recovery_speed(0)
	set_shield(0)
	assign_path(3)
	start_patrol
	set_ailist(CHR_SELF, GAILIST_UNALERTED_0004)
	endlist
};

u8 func1008_check_generator[] = {
	beginloop(0x04)
		chr_toggle_p1p2(CHR_SELF)
		if_chr_activated_object(CHR_P1P2, OBJ_GENERATOR, /*goto*/ 0x08)
		if_object_in_good_condition(OBJ_GENERATOR, /*goto*/ 0x2c)
		if_stage_flag_eq(STAGEFLAG_GENERATOR_SHUT_DOWN, TRUE, /*goto*/ 0x2c)

		// Destroyed
		mute_channel(CHANNEL_4)
		if_difficulty_lt(DIFF_PA, /*goto*/ 0x06)
		show_hudmsg(CHR_BOND, L_DEPO_024) // "Mission critical object destroyed."
		set_stage_flag(STAGEFLAG_GENERATOR_DESTROYED)
		label(0x06)
		set_ailist(CHR_SELF, GAILIST_IDLE)
		label(0x2c)
		reloop(0x04)

		// Generator activated
		label(0x08)
		if_stage_flag_eq(STAGEFLAG_GENERATOR_SHUT_DOWN2, TRUE, /*goto*/ 0x09)
		set_object_image(OBJ_GENERATOR, 0, TVCMDLIST_14)
		set_object_image(OBJ_GENERATOR, 1, TVCMDLIST_14)
		mute_channel(CHANNEL_4)
		mute_channel(CHANNEL_0)
		assign_sound(SFX_8147, CHANNEL_0)
		set_object_sound_playing(CHANNEL_0, OBJ_GENERATOR, TRUE)
		show_hudmsg(CHR_P1P2, L_DEPO_025) // "Damping field generator shut down."
		set_stage_flag(STAGEFLAG_GENERATOR_SHUT_DOWN2)
		set_stage_flag(STAGEFLAG_GENERATOR_SHUT_DOWN)
		reloop(0x04)

		label(0x09)
		show_hudmsg(CHR_P1P2, L_DEPO_026) // "Generator cannot be restarted."
	endloop(0x04)

	endlist
};

u8 func1003_laser_switch_1[] = {
	assign_sound(SFX_8119, CHANNEL_0)
	play_repeating_sound_from_object(CHANNEL_0, OBJ_LASER_1A, 1, 300, 400)

	beginloop(0x04)
		chr_toggle_p1p2(CHR_SELF)
		if_chr_activated_object(CHR_P1P2, OBJ_LASERSWITCH1, /*goto*/ 0x08)
		if_object_in_good_condition(OBJ_LASERSWITCH1, /*goto*/ 0x2c)
		if_stage_flag_eq(STAGEFLAG_LASERSET1_DISABLED, TRUE, /*goto*/ 0x2c)
		show_hudmsg(CHR_BOND, L_DEPO_024) // "Mission critical object destroyed."
		set_stage_flag(STAGEFLAG_LASERSWITCH1_DESTROYED)
		set_ailist(CHR_SELF, GAILIST_IDLE)
		label(0x2c)
		reloop(0x04)

		// Activated/deactivated
		label(0x08)
		if_stage_flag_eq(STAGEFLAG_LASERSET1_DISABLED, TRUE, /*goto*/ 0x09)

		// Deactivated
		set_object_image(OBJ_LASERSWITCH1, 0, TVCMDLIST_14)
		show_hudmsg(CHR_P1P2, L_DEPO_027) // "Laser grid unit shut down."
		set_stage_flag(STAGEFLAG_LASERSET1_DISABLED)
		open_door(OBJ_LASER_1A)
		open_door(OBJ_LASER_1B)
		open_door(OBJ_LASER_1C)
		open_door(OBJ_LASER_1D)
		yield
		set_object_flag(OBJ_LASER_1A, OBJFLAG_DOOR_KEEPOPEN)
		set_object_flag(OBJ_LASER_1B, OBJFLAG_DOOR_KEEPOPEN)
		set_object_flag(OBJ_LASER_1C, OBJFLAG_DOOR_KEEPOPEN)
		set_object_flag(OBJ_LASER_1D, OBJFLAG_DOOR_KEEPOPEN)
		assign_sound(SFX_043F, CHANNEL_7)
		play_sound_from_entity(CHANNEL_7, OBJ_LASERSWITCH1, 0x012c, 0x0190, 0x00)
		mute_channel(CHANNEL_0)
		assign_sound(SFX_PICKUP_SHIELD, CHANNEL_0)
		play_sound_from_entity(CHANNEL_0, OBJ_LASER_1A, 0x012c, 0x0190, 0x00)
		goto_next(0x0a)

		// Activated
		label(0x09)
		show_hudmsg(CHR_P1P2, L_DEPO_028) // "Laser grid unit activated."
		unset_stage_flag(STAGEFLAG_LASERSET1_DISABLED)
		set_object_image(OBJ_LASERSWITCH1, 0, TVCMDLIST_13)
		close_door(OBJ_LASER_1A)
		close_door(OBJ_LASER_1B)
		close_door(OBJ_LASER_1C)
		close_door(OBJ_LASER_1D)
		assign_sound(SFX_043F, CHANNEL_7)
		play_sound_from_entity(CHANNEL_7, OBJ_LASERSWITCH1, 0x012c, 0x0190, 0x00)
		assign_sound(SFX_8119, CHANNEL_0)
		play_repeating_sound_from_object(CHANNEL_0, OBJ_LASER_1A, 1, 300, 400)
		goto_next(0x0a)
		label(0x0a)
		restart_timer

		beginloop(0x0b)
			if_timer_gt(120, /*goto*/ 0x06)
		endloop(0x0b)

		label(0x06)
	endloop(0x04)

	endlist
};

u8 func1004_laser_switch_2[] = {
	assign_sound(SFX_8119, CHANNEL_1)
	play_repeating_sound_from_object(CHANNEL_1, OBJ_LASER_2A, 1, 300, 400)

	beginloop(0x04)
		chr_toggle_p1p2(CHR_SELF)
		if_chr_activated_object(CHR_P1P2, OBJ_LASERSWITCH2, /*goto*/ 0x08)
		if_object_in_good_condition(OBJ_LASERSWITCH2, /*goto*/ 0x2c)
		if_stage_flag_eq(STAGEFLAG_LASERSET2_DISABLED, TRUE, /*goto*/ 0x2c)
		show_hudmsg(CHR_BOND, L_DEPO_024) // "Mission critical object destroyed."
		set_stage_flag(STAGEFLAG_LASERSWITCH2_DESTROYED)
		set_ailist(CHR_SELF, GAILIST_IDLE)
		label(0x2c)
		reloop(0x04)

		// Activated/deactivated
		label(0x08)
		dprint 'S','W','I','T','C','H',' ','2',0,
		if_stage_flag_eq(STAGEFLAG_LASERSET2_DISABLED, TRUE, /*goto*/ 0x09)

		// Deactivated
		set_object_image(OBJ_LASERSWITCH2, 0, TVCMDLIST_14)
		show_hudmsg(CHR_P1P2, L_DEPO_027) // "Laser grid unit shut down."
		set_stage_flag(STAGEFLAG_LASERSET2_DISABLED)
		open_door(OBJ_LASER_2A)
		open_door(OBJ_LASER_2B)
		open_door(OBJ_LASER_2C)
		open_door(OBJ_LASER_2D)
		yield
		set_object_flag(OBJ_LASER_2A, OBJFLAG_DOOR_KEEPOPEN)
		set_object_flag(OBJ_LASER_2B, OBJFLAG_DOOR_KEEPOPEN)
		set_object_flag(OBJ_LASER_2C, OBJFLAG_DOOR_KEEPOPEN)
		set_object_flag(OBJ_LASER_2D, OBJFLAG_DOOR_KEEPOPEN)
		assign_sound(SFX_043F, CHANNEL_7)
		play_sound_from_entity(CHANNEL_7, OBJ_LASERSWITCH2, 0x012c, 0x0190, 0x00)
		mute_channel(CHANNEL_1)
		assign_sound(SFX_PICKUP_SHIELD, CHANNEL_1)
		play_sound_from_entity(CHANNEL_1, OBJ_LASER_2A, 0x012c, 0x0190, 0x00)
		goto_next(0x0a)

		// Activated
		label(0x09)
		set_object_image(OBJ_LASERSWITCH2, 0, TVCMDLIST_13)
		show_hudmsg(CHR_P1P2, L_DEPO_028) // "Laser grid unit activated."
		unset_stage_flag(STAGEFLAG_LASERSET2_DISABLED)
		close_door(OBJ_LASER_2A)
		close_door(OBJ_LASER_2B)
		close_door(OBJ_LASER_2C)
		close_door(OBJ_LASER_2D)
		assign_sound(SFX_043F, CHANNEL_7)
		play_sound_from_entity(CHANNEL_7, OBJ_LASERSWITCH2, 0x012c, 0x0190, 0x00)
		assign_sound(SFX_8119, CHANNEL_1)
		play_repeating_sound_from_object(CHANNEL_1, OBJ_LASER_2A, 1, 300, 400)
		goto_next(0x0a)
		label(0x0a)
		restart_timer

		beginloop(0x0b)
			if_timer_gt(120, /*goto*/ 0x06)
		endloop(0x0b)

		label(0x06)
	endloop(0x04)

	endlist
};

u8 func1005_laser_switch_3[] = {
	assign_sound(SFX_8119, CHANNEL_2)
	play_repeating_sound_from_object(CHANNEL_2, OBJ_LASER_3A, 1, 300, 400)

	beginloop(0x04)
		chr_toggle_p1p2(CHR_SELF)
		if_chr_activated_object(CHR_P1P2, OBJ_LASERSWITCH3, /*goto*/ 0x08)
		if_object_in_good_condition(OBJ_LASERSWITCH3, /*goto*/ 0x2c)
		if_stage_flag_eq(STAGEFLAG_LASERSET3_DISABLED, TRUE, /*goto*/ 0x2c)
		show_hudmsg(CHR_BOND, L_DEPO_024) // "Mission critical object destroyed."
		set_stage_flag(STAGEFLAG_LASERSWITCH3_DESTROYED)
		set_ailist(CHR_SELF, GAILIST_IDLE)
		label(0x2c)
		reloop(0x04)

		// Activated/deactivated
		label(0x08)
		if_stage_flag_eq(STAGEFLAG_LASERSET3_DISABLED, TRUE, /*goto*/ 0x09)

		// Deactivated
		set_object_image(OBJ_LASERSWITCH3, 0, TVCMDLIST_14)
		show_hudmsg(CHR_P1P2, L_DEPO_027) // "Laser grid unit shut down."
		set_stage_flag(STAGEFLAG_LASERSET3_DISABLED)
		open_door(OBJ_LASER_3A)
		open_door(OBJ_LASER_3B)
		open_door(OBJ_LASER_3C)
		open_door(OBJ_LASER_3D)
		yield
		set_object_flag(OBJ_LASER_3A, OBJFLAG_DOOR_KEEPOPEN)
		set_object_flag(OBJ_LASER_3B, OBJFLAG_DOOR_KEEPOPEN)
		set_object_flag(OBJ_LASER_3C, OBJFLAG_DOOR_KEEPOPEN)
		set_object_flag(OBJ_LASER_3D, OBJFLAG_DOOR_KEEPOPEN)
		assign_sound(SFX_043F, CHANNEL_7)
		play_sound_from_entity(CHANNEL_7, OBJ_LASERSWITCH3, 0x012c, 0x0190, 0x00)
		mute_channel(CHANNEL_2)
		assign_sound(SFX_PICKUP_SHIELD, CHANNEL_2)
		play_sound_from_entity(CHANNEL_2, OBJ_LASER_3A, 0x012c, 0x0190, 0x00)
		goto_next(0x0a)

		// Activated
		label(0x09)
		set_object_image(OBJ_LASERSWITCH3, 0, TVCMDLIST_13)
		show_hudmsg(CHR_P1P2, L_DEPO_028) // "Laser grid unit activated."
		unset_stage_flag(STAGEFLAG_LASERSET3_DISABLED)
		close_door(OBJ_LASER_3A)
		close_door(OBJ_LASER_3B)
		close_door(OBJ_LASER_3C)
		close_door(OBJ_LASER_3D)
		assign_sound(SFX_043F, CHANNEL_7)
		play_sound_from_entity(CHANNEL_7, OBJ_LASERSWITCH3, 0x012c, 0x0190, 0x00)
		assign_sound(SFX_8119, CHANNEL_2)
		play_repeating_sound_from_object(CHANNEL_2, OBJ_LASER_3A, 1, 300, 400)
		goto_next(0x0a)
		label(0x0a)
		restart_timer

		beginloop(0x0b)
			if_timer_gt(120, /*goto*/ 0x06)
		endloop(0x0b)

		label(0x06)
	endloop(0x04)

	endlist
};

u8 func1006_laser_switch_4[] = {
	assign_sound(SFX_811A, CHANNEL_3)
	play_repeating_sound_from_object(CHANNEL_3, OBJ_LASER_4A, 1, 300, 400)

	beginloop(0x04)
		chr_toggle_p1p2(CHR_SELF)
		if_chr_activated_object(CHR_P1P2, OBJ_LASERSWITCH4, /*goto*/ 0x08)
		if_object_in_good_condition(OBJ_LASERSWITCH4, /*goto*/ 0x2c)
		if_stage_flag_eq(STAGEFLAG_LASERSET4_DISABLED, TRUE, /*goto*/ 0x2c)
		show_hudmsg(CHR_BOND, L_DEPO_024) // "Mission critical object destroyed."
		set_stage_flag(STAGEFLAG_LASERSWITCH4_DESTROYED)
		set_ailist(CHR_SELF, GAILIST_IDLE)
		label(0x2c)
		reloop(0x04)

		// Activated/deactivated
		label(0x08)
		if_stage_flag_eq(STAGEFLAG_LASERSET4_DISABLED, TRUE, /*goto*/ 0x09)

		// Deactivated
		set_object_image(OBJ_LASERSWITCH4, 0, TVCMDLIST_14)
		show_hudmsg(CHR_P1P2, L_DEPO_027) // "Laser grid unit shut down."
		set_stage_flag(STAGEFLAG_LASERSET4_DISABLED)
		open_door(OBJ_LASER_4A)
		open_door(OBJ_LASER_4B)
		open_door(OBJ_LASER_4C)
		open_door(OBJ_LASER_4D)
		yield
		set_object_flag(OBJ_LASER_4A, OBJFLAG_DOOR_KEEPOPEN)
		set_object_flag(OBJ_LASER_4B, OBJFLAG_DOOR_KEEPOPEN)
		set_object_flag(OBJ_LASER_4C, OBJFLAG_DOOR_KEEPOPEN)
		set_object_flag(OBJ_LASER_4D, OBJFLAG_DOOR_KEEPOPEN)
		assign_sound(SFX_043F, CHANNEL_7)
		play_sound_from_entity(CHANNEL_7, OBJ_LASERSWITCH4, 0x012c, 0x0190, 0x00)
		mute_channel(CHANNEL_3)
		assign_sound(SFX_PICKUP_SHIELD, CHANNEL_3)
		play_sound_from_entity(CHANNEL_3, OBJ_LASER_4A, 0x012c, 0x0190, 0x00)
		goto_next(0x0a)

		// Activated
		label(0x09)
		set_object_image(OBJ_LASERSWITCH4, 0, TVCMDLIST_13)
		show_hudmsg(CHR_P1P2, L_DEPO_028) // "Laser grid unit activated."
		unset_stage_flag(STAGEFLAG_LASERSET4_DISABLED)
		close_door(OBJ_LASER_4A)
		close_door(OBJ_LASER_4B)
		close_door(OBJ_LASER_4C)
		close_door(OBJ_LASER_4D)
		assign_sound(SFX_043F, CHANNEL_7)
		play_sound_from_entity(CHANNEL_7, OBJ_LASERSWITCH4, 0x012c, 0x0190, 0x00)
		assign_sound(SFX_811A, CHANNEL_3)
		play_repeating_sound_from_object(CHANNEL_3, OBJ_LASER_4A, 1, 300, 400)
		goto_next(0x0a)
		label(0x0a)
		restart_timer

		beginloop(0x0b)
			if_timer_gt(120, /*goto*/ 0x06)
		endloop(0x0b)

		label(0x06)
	endloop(0x04)

	endlist
};

u8 func1007_init_lasers[] = {
	yield

	// Wait for cutscene to finish
	beginloop(0x8f)
		if_camera_animating(/*goto*/ 0x2c)
		goto_next(0x06)
		label(0x2c)
	endloop(0x8f)

	label(0x06)
	if_difficulty_lt(DIFF_SA, /*goto*/ 0x0d)

	// SA/PA - bring up lasers
	close_door(OBJ_LASER_1A)
	close_door(OBJ_LASER_2A)
	close_door(OBJ_LASER_3A)
	close_door(OBJ_LASER_4A)
	close_door(OBJ_LASER_1B)
	close_door(OBJ_LASER_2B)
	close_door(OBJ_LASER_3B)
	close_door(OBJ_LASER_4B)
	close_door(OBJ_LASER_1C)
	close_door(OBJ_LASER_2C)
	close_door(OBJ_LASER_3C)
	close_door(OBJ_LASER_4C)
	close_door(OBJ_LASER_1D)
	close_door(OBJ_LASER_2D)
	close_door(OBJ_LASER_3D)
	close_door(OBJ_LASER_4D)

	// Wait until all lasers disabled, show message and set flag
	beginloop(0x04)
		if_stage_flag_eq(STAGEFLAG_LASERSET1_DISABLED, FALSE, /*goto*/ 0x2c)
		if_stage_flag_eq(STAGEFLAG_LASERSET2_DISABLED, FALSE, /*goto*/ 0x2c)
		if_stage_flag_eq(STAGEFLAG_LASERSET3_DISABLED, FALSE, /*goto*/ 0x2c)
		if_stage_flag_eq(STAGEFLAG_LASERSET4_DISABLED, FALSE, /*goto*/ 0x2c)
		if_stage_flag_eq(STAGEFLAG_ALL_LASERS_DISABLED, TRUE, /*goto*/ 0x2c)
		show_hudmsg(CHR_BOND, L_DEPO_029) // "All laser grid systems shut down."
		set_stage_flag(STAGEFLAG_ALL_LASERS_DISABLED)
		label(0x2c)
	endloop(0x04)

	// Agent - take down lasers
	label(0x0d)
	set_object_image(OBJ_LASERSWITCH1, 0, TVCMDLIST_14)
	set_object_image(OBJ_LASERSWITCH2, 0, TVCMDLIST_14)
	set_object_image(OBJ_LASERSWITCH3, 0, TVCMDLIST_14)
	set_object_image(OBJ_LASERSWITCH4, 0, TVCMDLIST_14)
	open_door(OBJ_LASER_1A)
	open_door(OBJ_LASER_2A)
	open_door(OBJ_LASER_3A)
	open_door(OBJ_LASER_4A)
	open_door(OBJ_LASER_1B)
	open_door(OBJ_LASER_2B)
	open_door(OBJ_LASER_3B)
	open_door(OBJ_LASER_4B)
	open_door(OBJ_LASER_1C)
	open_door(OBJ_LASER_2C)
	open_door(OBJ_LASER_3C)
	open_door(OBJ_LASER_4C)
	open_door(OBJ_LASER_1D)
	open_door(OBJ_LASER_2D)
	open_door(OBJ_LASER_3D)
	open_door(OBJ_LASER_4D)
	yield
	set_object_flag(OBJ_LASER_1A, OBJFLAG_DOOR_KEEPOPEN)
	set_object_flag(OBJ_LASER_2A, OBJFLAG_DOOR_KEEPOPEN)
	set_object_flag(OBJ_LASER_3A, OBJFLAG_DOOR_KEEPOPEN)
	set_object_flag(OBJ_LASER_4A, OBJFLAG_DOOR_KEEPOPEN)
	set_object_flag(OBJ_LASER_1B, OBJFLAG_DOOR_KEEPOPEN)
	set_object_flag(OBJ_LASER_2B, OBJFLAG_DOOR_KEEPOPEN)
	set_object_flag(OBJ_LASER_3B, OBJFLAG_DOOR_KEEPOPEN)
	set_object_flag(OBJ_LASER_4B, OBJFLAG_DOOR_KEEPOPEN)
	set_object_flag(OBJ_LASER_1C, OBJFLAG_DOOR_KEEPOPEN)
	set_object_flag(OBJ_LASER_2C, OBJFLAG_DOOR_KEEPOPEN)
	set_object_flag(OBJ_LASER_3C, OBJFLAG_DOOR_KEEPOPEN)
	set_object_flag(OBJ_LASER_4C, OBJFLAG_DOOR_KEEPOPEN)
	set_object_flag(OBJ_LASER_1D, OBJFLAG_DOOR_KEEPOPEN)
	set_object_flag(OBJ_LASER_2D, OBJFLAG_DOOR_KEEPOPEN)
	set_object_flag(OBJ_LASER_3D, OBJFLAG_DOOR_KEEPOPEN)
	set_object_flag(OBJ_LASER_4D, OBJFLAG_DOOR_KEEPOPEN)
	set_stage_flag(STAGEFLAG_LASERSET1_DISABLED)
	set_stage_flag(STAGEFLAG_LASERSET2_DISABLED)
	set_stage_flag(STAGEFLAG_LASERSET3_DISABLED)
	set_stage_flag(STAGEFLAG_LASERSET4_DISABLED)
	set_stage_flag(STAGEFLAG_ALL_LASERS_DISABLED)
	label(0x0e)
	yield
	open_door(OBJ_LASER_1A)
	open_door(OBJ_LASER_2A)
	open_door(OBJ_LASER_3A)
	open_door(OBJ_LASER_4A)
	open_door(OBJ_LASER_1B)
	open_door(OBJ_LASER_2B)
	open_door(OBJ_LASER_3B)
	open_door(OBJ_LASER_4B)
	open_door(OBJ_LASER_1C)
	open_door(OBJ_LASER_2C)
	open_door(OBJ_LASER_3C)
	open_door(OBJ_LASER_4C)
	open_door(OBJ_LASER_1D)
	open_door(OBJ_LASER_2D)
	open_door(OBJ_LASER_3D)
	open_door(OBJ_LASER_4D)
	yield
	mute_channel(CHANNEL_0)
	mute_channel(CHANNEL_1)
	mute_channel(CHANNEL_2)
	mute_channel(CHANNEL_3)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func1009_spawner_during_decode[] = {
	// Wait for alarm or decoder attached
	beginloop(0x04)
		if_stage_flag_eq(STAGEFLAG_DECODER_ATTACHED, TRUE, /*goto*/ 0x06)
		if_alarm_active(/*goto*/ 0x61)
	endloop(0x04)

	// Decoder is attached
	label(0x06)
	yield
	yield

	// Wait 8.3 seconds
	restart_timer

	beginloop(0x08)
		if_timer_gt(500, /*goto*/ 0x06)
	endloop(0x08)

	label(0x06)
	activate_alarm

	// Spawn two swat guards
	label(0x61)
	try_spawn_chr_at_pad(BODY_G5_SWAT_GUARD, HEAD_RANDOM, PAD_DEPO_0058, 0x0401, SPAWNFLAG_BASICGUARD, /*goto*/ 0x06)
	label(0x06)
	try_spawn_chr_at_pad(BODY_G5_SWAT_GUARD, HEAD_RANDOM, PAD_DEPO_003F, 0x0402, SPAWNFLAG_BASICGUARD, /*goto*/ 0x06)
	label(0x06)

	// Every half second, use RNG to decide whether to consider spawning more.
	// 55/255 chance of passing.
	label(0x09)
		restart_timer
		call_rng

		beginloop(0x0a)
			if_rand_gt(200, /*goto*/ 0x06)
			if_timer_gt(30, /*goto*/ 0x2c)
		endloop(0x0a)

		label(0x2c)
		reloop(0x09)

		label(0x06)
		if_difficulty_lt(DIFF_SA, /*goto*/ 0x55)
		if_difficulty_lt(DIFF_PA, /*goto*/ 0x56)
		if_num_chrs_in_squadron_gt(5, 0x09, /*goto*/ 0x2c)
		if_kill_count_gt(50, /*goto*/ 0x2c)
		goto_next(0x57)

		// Agent
		label(0x55)
		if_num_chrs_in_squadron_gt(3, 0x09, /*goto*/ 0x2c)
		if_kill_count_gt(50, /*goto*/ 0x2c)
		goto_next(0x57)

		// Special Agent
		label(0x56)
		if_num_chrs_in_squadron_gt(4, 0x09, /*goto*/ 0x2c)
		if_kill_count_gt(50, /*goto*/ 0x2c)
		goto_next(0x57)

		// All difficulties
		label(0x57)
		call_rng
		if_rand_gt(128, /*goto*/ 0x0b)
		if_stage_flag_eq(STAGEFLAG_VISITED_TOP_DOOR, TRUE, /*goto*/ 0x2c)
		try_spawn_chr_at_pad(BODY_G5_SWAT_GUARD, HEAD_RANDOM, PAD_DEPO_0058, 0x0401, SPAWNFLAG_BASICGUARD, /*goto*/ 0x06)
		label(0x06)
		goto_next(0x0d)

		label(0x2c)
		dprint 'S','Q','U','A','D',' ','F','U','L','L',0,
		reloop(0x09)

		label(0x0b)
		try_spawn_chr_at_pad(BODY_G5_SWAT_GUARD, HEAD_RANDOM, PAD_DEPO_003F, 0x0402, SPAWNFLAG_BASICGUARD, /*goto*/ 0x06)
		label(0x06)
		label(0x0d)
		restart_timer

		beginloop(0x0e)
			if_timer_gt(30, /*goto*/ 0x06)
		endloop(0x0e)

		label(0x06)
	endloop(0x09)

	endlist
};

#define init_swat \
	set_chr_hiddenflag(CHR_SELF, CHRHFLAG_BASICGUARD) \
	set_self_flag_bankx(CHRFLAG1_NOIDLEANIMS, BANK_1) \
	set_chr_dodge_rating(2, 10) \
	set_accuracy(15) \
	set_reaction_speed(25) \
	set_chr_maxdamage(CHR_SELF, 40) \
	add_health_or_armor(0) \
	set_recovery_speed(0) \
	set_shield(0) \
	try_equip_weapon(MODEL_CHRDY357, WEAPON_DY357MAGNUM, 0x10000000, /*goto*/ 0x06) \
	label(0x06) \
	set_chr_team(CHR_SELF, TEAM_ENEMY) \
	set_squadron(SQUADRON_09) \
	set_chr_chrflag(CHR_SELF, CHRCFLAG_KILLCOUNTABLE) \
	set_self_flag_bankx(CHRFLAG0_SKIPSAFETYCHECKS, BANK_0) \
	set_self_flag_bankx(CHRFLAG0_00008000, BANK_0) \
	set_alertness(90) \
	set_self_chrflag(CHRCFLAG_CANCHANGEACTDURINGARGH) \
	rebuild_teams \
	rebuild_squadrons \
	run_to_pad(PAD_DEPO_004E)

u8 func0401_init_swat1[] = {
	init_swat

	beginloop(0x08)
		chr_toggle_p1p2(CHR_SELF)
		set_target_chr(CHR_P1P2)
		if_los_to_target(/*goto*/ 0x2c)
		if_enemy_distance_lt_and_los(2540, /*goto*/ 0x2c)
		if_chr_in_room(CHR_SELF, 0x00, 0x0050, /*goto*/ 0x06)
	endloop(0x08)

	label(0x2c)
	set_ailist(CHR_SELF, GAILIST_UNALERTED)

	label(0x06)
	set_returnlist(CHR_SELF, GAILIST_UNALERTED)
	set_ailist(CHR_SELF, GAILIST_ALERTED)
	endlist
};

/**
 * Same as above, but guards with this function will become unalerted if they
 * lose sight of Jo regardless of what room they're in.
 */
u8 func0402_init_swat2[] = {
	init_swat

	beginloop(0x08)
		chr_toggle_p1p2(CHR_SELF)
		set_target_chr(CHR_P1P2)
		if_los_to_target(/*goto*/ 0x2c)
		if_enemy_distance_lt_and_los(2540, /*goto*/ 0x2c)
		if_chr_in_room(CHR_SELF, 0x00, 0x0050, /*goto*/ 0x06)
		if_chr_stopped(/*goto*/ 0x06)
	endloop(0x08)

	label(0x2c)
	set_ailist(CHR_SELF, GAILIST_UNALERTED)

	label(0x06)
	set_returnlist(CHR_SELF, GAILIST_UNALERTED)
	set_ailist(CHR_SELF, GAILIST_ALERTED)
	endlist
};

u8 func100a_give_keycards[] = {
	set_object_flag(OBJ_KEYCARD1, OBJFLAG_UNCOLLECTABLE)
	set_object_flag2(OBJ_KEYCARD1, OBJFLAG2_INVISIBLE)
	set_object_flag(OBJ_KEYCARD2, OBJFLAG_UNCOLLECTABLE)
	set_object_flag2(OBJ_KEYCARD2, OBJFLAG2_INVISIBLE)
	set_object_flag2(OBJ_CROSSBOW, OBJFLAG2_INVISIBLE)
	set_object_flag(OBJ_CROSSBOW, OBJFLAG_UNCOLLECTABLE)

	set_chr_chrflag(CHR_CLOAK_1A, CHRCFLAG_KILLCOUNTABLE)
	set_chr_chrflag(CHR_CLOAK_1B, CHRCFLAG_KILLCOUNTABLE)
	set_chr_chrflag(CHR_CLOAK_2A, CHRCFLAG_KILLCOUNTABLE)
	set_chr_chrflag(CHR_CLOAK_2B, CHRCFLAG_KILLCOUNTABLE)
	set_chr_chrflag(CHR_CLOAK_2C, CHRCFLAG_KILLCOUNTABLE)
	set_chr_chrflag(CHR_CLOAK_2D, CHRCFLAG_KILLCOUNTABLE)

	// Wait for trigger
	beginloop(0x04)
		if_stage_flag_eq(STAGEFLAG_CLOAK1_ONE_REMAINING, TRUE, /*goto*/ 0x2c)
	endloop(0x04)

	label(0x2c)
	if_chr_dead(CHR_CLOAK_1A, /*goto*/ 0x06)
	if_chr_death_animation_finished(CHR_CLOAK_1A, /*goto*/ 0x06)
	if_chr_knockedout(CHR_CLOAK_1A, /*goto*/ 0x06)

	// First cloacked guard is alive
	give_object_to_chr(OBJ_KEYCARD1, CHR_CLOAK_1A)
	give_object_to_chr(OBJ_CROSSBOW, CHR_CLOAK_1A)
	set_target_chr(CHR_CLOAK_1A)
	goto_next(0x2c)

	// First cloaked guard is dead
	label(0x06)
	give_object_to_chr(OBJ_KEYCARD1, CHR_CLOAK_1B)
	give_object_to_chr(OBJ_CROSSBOW, CHR_CLOAK_1B)
	set_target_chr(CHR_CLOAK_1B)

	label(0x2c)
	unset_object_flag(OBJ_KEYCARD1, OBJFLAG_UNCOLLECTABLE)
	unset_object_flag2(OBJ_KEYCARD1, OBJFLAG2_INVISIBLE)
	unset_object_flag2(OBJ_CROSSBOW, OBJFLAG2_INVISIBLE)
	unset_object_flag(OBJ_CROSSBOW, OBJFLAG_UNCOLLECTABLE)

	// Wait for the chr who holds the keycard to die
	beginloop(0x55)
		if_chr_knockedout(CHR_TARGET, /*goto*/ 0x08)
		if_chr_dead(CHR_TARGET, /*goto*/ 0x2c)
		if_chr_death_animation_finished(CHR_TARGET, /*goto*/ 0x2c)
	endloop(0x55)

	label(0x2c)
	set_object_flag2(OBJ_CROSSBOW, OBJFLAG2_INVISIBLE)
	set_object_flag(OBJ_CROSSBOW, OBJFLAG_UNCOLLECTABLE)
	disable_object(OBJ_CROSSBOW)

	beginloop(0x08)
		dprint 'C','H','E','C','K',' ','D','E','A','D',0,
		if_stage_flag_eq(STAGEFLAG_CLOAK2_ONE_REMAINING, TRUE, /*goto*/ 0x2c)
	endloop(0x08)

	// Second room
	label(0x2c)
	if_chr_dead(CHR_CLOAK_2A, /*goto*/ 0x06)
	if_chr_death_animation_finished(CHR_CLOAK_2A, /*goto*/ 0x06)
	if_chr_knockedout(CHR_CLOAK_2A, /*goto*/ 0x06)

	// 2A alive
	give_object_to_chr(OBJ_KEYCARD2, CHR_CLOAK_2A)
	dprint 'G','I','V','E',' ','T','O','4',0,
	goto_next(0x2c)

	// 2A dead
	label(0x06)
	if_chr_dead(CHR_CLOAK_2B, /*goto*/ 0x06)
	if_chr_death_animation_finished(CHR_CLOAK_2B, /*goto*/ 0x06)
	if_chr_knockedout(CHR_CLOAK_2B, /*goto*/ 0x06)
	give_object_to_chr(OBJ_KEYCARD2, CHR_CLOAK_2B)
	dprint 'G','I','V','E',' ','T','O','5',0,
	goto_next(0x2c)

	// 2B dead
	label(0x06)
	if_chr_dead(CHR_CLOAK_2C, /*goto*/ 0x06)
	if_chr_death_animation_finished(CHR_CLOAK_2C, /*goto*/ 0x06)
	if_chr_knockedout(CHR_CLOAK_2C, /*goto*/ 0x06)
	give_object_to_chr(OBJ_KEYCARD2, CHR_CLOAK_2C)
	dprint 'G','I','V','E',' ','T','O','6',0,
	goto_next(0x2c)

	// 2C dead
	label(0x06)
	give_object_to_chr(OBJ_KEYCARD2, CHR_CLOAK_2D)
	dprint 'G','I','V','E',' ','T','O','7',0,

	label(0x2c)
	unset_object_flag(OBJ_KEYCARD2, OBJFLAG_UNCOLLECTABLE)
	unset_object_flag2(OBJ_KEYCARD2, OBJFLAG2_INVISIBLE)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func100b_check_backup_collected[] = {
	beginloop(0x04)
		chr_toggle_p1p2(CHR_SELF)
		if_chr_has_object(CHR_P1P2, OBJ_BACKUPDISK, /*goto*/ 0x2c)
	endloop(0x04)

	label(0x2c)
	set_stage_flag(STAGEFLAG_BACKUP_COLLECTED)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func1002_set_ai[] = {
	set_ailist(CHR_SELF, GAILIST_REBUILD_GROUPS)
	endlist
};

u8 func1400_setup_counterop[] = {
	yield
	set_chr_team(CHR_ANTI, TEAM_ENEMY)

	// On counterop SA and PA, give Joanna a CMP150
	if_difficulty_lt(DIFF_SA, /*goto*/ 0x06)
	give_object_to_chr(OBJ_CMP150_BOND, CHR_BOND)
	give_object_to_chr(OBJ_CMP150_COOP, CHR_COOP)
	label(0x06)
	set_ailist(CHR_SELF, GAILIST_REBUILD_GROUPS)
	endlist
};

u8 func100e_check_conspirators_alerted[] = {
	// Wait for alarm
	beginloop(0x04)
		if_alarm_active(/*goto*/ 0x06)
		reloop(0x04)

		// These objects are doors
		label(0x06)
		unset_object_flag2(0x3f, OBJFLAG2_AICANNOTUSE)
		unset_object_flag2(0x40, OBJFLAG2_AICANNOTUSE)
		unset_object_flag2(0x41, OBJFLAG2_AICANNOTUSE)
		unset_object_flag2(0x42, OBJFLAG2_AICANNOTUSE)
		unset_object_flag2(0x43, OBJFLAG2_AICANNOTUSE)
		unset_object_flag2(0x44, OBJFLAG2_AICANNOTUSE)
		unset_object_flag2(0x45, OBJFLAG2_AICANNOTUSE)
		unset_object_flag2(0x46, OBJFLAG2_AICANNOTUSE)
		unset_object_flag2(0x34, OBJFLAG2_AICANNOTUSE)
		unset_object_flag2(0x35, OBJFLAG2_AICANNOTUSE)
		unset_object_flag2(0x36, OBJFLAG2_AICANNOTUSE)
		unset_object_flag2(0x37, OBJFLAG2_AICANNOTUSE)

		set_stage_flag(STAGEFLAG_ALARM_SOUNDING)
		if_stage_flag_eq(STAGEFLAG_MEETING_STARTED, TRUE, /*goto*/ 0x06)
		set_stage_flag(STAGEFLAG_CONSPIRATORS_ALERTED)
		set_ailist(CHR_CASS, AILIST_RUN_FROM_MEETING)
		set_ailist(0x1c, AILIST_RUN_FROM_MEETING) // chr doesn't exist
		set_ailist(CHR_BLONDE, AILIST_RUN_FROM_MEETING)
		show_hudmsg(CHR_BOND, L_DEPO_041) // "Conspirators have been alerted."

		// Wait until alarm not active
		label(0x06)

		beginloop(0x55)
			if_alarm_active(/*goto*/ 0x2c)
			goto_next(0x06)
			label(0x2c)
		endloop(0x55)

		label(0x06)
		unset_stage_flag(STAGEFLAG_ALARM_SOUNDING)
	endloop(0x04)

	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func100f_alarm_switches[] = {
	// Wait until player activated alarm switch
	beginloop(0x04)
		chr_toggle_p1p2(CHR_SELF)
		if_chr_activated_object(CHR_P1P2, OBJ_ALARM1, /*goto*/ 0x2c)
		if_chr_activated_object(CHR_P1P2, OBJ_ALARM2, /*goto*/ 0x2c)
		reloop(0x04)

		label(0x2c)
		if_stage_flag_eq(STAGEFLAG_ALARM_SOUNDING, TRUE, /*goto*/ 0x06)
		show_hudmsg(CHR_P1P2, L_DEPO_042) // "Alarm activated."
		set_stage_flag(STAGEFLAG_ALARM_SOUNDING)
		activate_alarm
		reloop(0x04)

		label(0x06)
		show_hudmsg(CHR_P1P2, L_DEPO_043) // "Alarm deactivated."
		unset_stage_flag(STAGEFLAG_ALARM_SOUNDING)
		deactivate_alarm
	endloop(0x04)

	endlist
};

u8 func1010_safe_cracking[] = {
	// Wait for player to activate keypad or for it to be destroyed
	beginloop(0x04)
		chr_toggle_p1p2(CHR_SELF)
		if_object_in_good_condition(OBJ_SAFEKEYPAD, /*goto*/ 0x2c)
		show_hudmsg(CHR_BOND, L_DEPO_064) // "Mission critical object destroyed."
		set_stage_flag(STAGEFLAG_SAFEKEYPAD_DESTROYED)
		set_ailist(CHR_SELF, GAILIST_IDLE)
		label(0x2c)
		if_chr_activated_object(CHR_P1P2, OBJ_SAFEKEYPAD, /*goto*/ 0x2c)
		reloop(0x04)

		label(0x2c)
		if_chr_weapon_equipped(CHR_P1P2, WEAPON_DOORDECODER, /*goto*/ 0x2c)
		show_hudmsg(CHR_P1P2, L_DEPO_044) // "Safe door is locked."
	endloop(0x04)

	label(0x2c)
	show_hudmsg(CHR_P1P2, L_DEPO_045) // "Door Decoder attached."
	remove_weapon_from_inventory(WEAPON_DOORDECODER)
	move_object_to_pad(OBJ_DECODER, PAD_DEPO_0075)
	set_stage_flag(STAGEFLAG_DECODER_ATTACHED)
	assign_sound(SFX_8144, CHANNEL_1)
	play_repeating_sound_from_object(CHANNEL_1, OBJ_SAFEKEYPAD, 1, 300, 400)
	restart_timer

	beginloop(0x09)
		if_timer_gt(180, /*goto*/ 0x06)
	endloop(0x09)

	label(0x06)
	speak(CHR_BOND, L_DEPO_038, MP3_0754, CHANNEL_5, COLOR_00_GREEN) // "INTRUDER ALERT - all security to the vault."
	play_x_track(XREASON_DEFAULT, 10, 180)
	yield
	set_countdown_timer(60)
	show_hudmsg(CHR_P1P2, L_DEPO_036) // "Initiating cracking routines."
	yield
	show_countdown_timer
	start_countdown_timer
	restart_timer

	beginloop(0x5e)
		if_timer_gt(180, /*goto*/ 0x2c)
	endloop(0x5e)

	label(0x2c)
	activate_alarm

	beginloop(0x08)
		if_object_in_good_condition(OBJ_SAFEKEYPAD, /*goto*/ 0x2c)
		show_hudmsg(CHR_BOND, L_DEPO_064) // "Mission critical object destroyed."
		set_stage_flag(STAGEFLAG_SAFEKEYPAD_DESTROYED)
		hide_countdown_timer
		set_ailist(CHR_SELF, GAILIST_IDLE)
		label(0x2c)
		if_countdown_timer_lt(1, /*goto*/ 0x06)
	endloop(0x08)

	// Unlock
	label(0x06)
	mute_channel(CHANNEL_1)
	assign_sound(SFX_8145, CHANNEL_1)
	set_object_sound_playing(CHANNEL_1, OBJ_SAFEKEYPAD, TRUE)
	show_hudmsg(CHR_P1P2, L_DEPO_037) // "Door Decoder finished - door unlocked."
	unlock_door(OBJ_SAFEDOOR, 0x40)
	unset_object_flag2(OBJ_SAFEDOOR, OBJFLAG2_AICANNOTUSE)
	open_door(OBJ_SAFEDOOR)
	hide_countdown_timer
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func1012_check_for_end[] = {
	// Wait until player on ending catwalk
	beginloop(0x08)
		chr_toggle_p1p2(CHR_SELF)
		if_chr_in_room(CHR_P1P2, 0x00, 0x0060, /*goto*/ 0x06)
		if_chr_in_room(CHR_P1P2, 0x00, 0x0061, /*goto*/ 0x06)
		reloop(0x08)

		label(0x06)
		if_chr_death_animation_finished(CHR_P1P2, /*goto*/ 0x2c)
		if_chr_dead(CHR_P1P2, /*goto*/ 0x2c)
		if_chr_knockedout(CHR_P1P2, /*goto*/ 0x2c)
		goto_next(0x06)
		label(0x2c)
	endloop(0x08)

	label(0x06)
	set_stage_flag(STAGEFLAG_EXITED_BUILDING)
	dprint 'I','N',' ','T','H','E',' ','E','L','E','V','A','T','O','R','\n',0,
	set_invincible(CHR_BOND)
	yield
	yield
	revoke_control(CHR_BOND, 4)
	hide_countdown_timer
	stop_countdown_timer
	if_all_objectives_complete(/*goto*/ 0x53)
	show_hudmsg(CHR_BOND, L_DEPO_051) // "Objectives incomplete - MISSION FAILED."
	label(0x2c)
	restart_timer

	beginloop(0x52)
		if_timer_gt(280, /*goto*/ 0x2c)
	endloop(0x52)

	label(0x2c)
	end_level
	set_ailist(CHR_SELF, GAILIST_IDLE)

	// Objectives complete
	label(0x53)
	if_chr_death_animation_finished(CHR_BOND, /*goto*/ 0x2c)
	if_chr_dead(CHR_BOND, /*goto*/ 0x2c)
	if_chr_knockedout(CHR_BOND, /*goto*/ 0x2c)
	goto_next(0x06)

	label(0x2c)
	if_chr_death_animation_finished(CHR_COOP, /*goto*/ 0x2c)
	if_chr_dead(CHR_COOP, /*goto*/ 0x2c)
	if_chr_knockedout(CHR_COOP, /*goto*/ 0x2c)
	goto_next(0x06)

	label(0x2c)
	end_level
	set_ailist(CHR_SELF, GAILIST_IDLE)

	// Mission complete
	label(0x06)
	set_ailist(CHR_SELF, AILIST_OUTRO)
	endlist
};

u8 func1013_check_escape_doors[] = {
	beginloop(0x04)
		if_object_in_good_condition(OBJ_ESCAPEDOOR1, /*goto*/ 0x06)
		goto_next(0x2c)
		label(0x06)
		if_object_in_good_condition(OBJ_ESCAPEDOOR2, /*goto*/ 0x06)
		label(0x2c)
		dprint 'S','T','A','R','T',' ','A','L','A','R','M','\n',0,
		activate_alarm
		set_ailist(CHR_SELF, GAILIST_IDLE)
		reloop(0x04)

		label(0x06)
	endloop(0x04)

	endlist
};

u8 func1014_check_camspy_location[] = {
	beginloop(0x04)
		chr_toggle_p1p2(CHR_SELF)
		if_chr_in_room(0x00, /*camspy*/ 0x02, VERSION >= VERSION_NTSC_1_0 ? 0x0094 : 0x003a, /*goto*/ 0x06)
	endloop(0x04)

	label(0x06)
	if_stage_flag_eq(STAGEFLAG_CONSPIRATORS_ALERTED, TRUE, /*goto*/ 0x2c)
	set_stage_flag(STAGEFLAG_MEETING_HOLOGRAPHED)

	label(0x2c)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func100c_check_for_meeting_trigger[] = {
	// Wait until meeting started then start cutscene
	beginloop(0x00)
		if_stage_flag_eq(STAGEFLAG_MEETING_HOLOGRAPHED, TRUE, /*goto*/ 0x06)
	endloop(0x00)

	label(0x06)
	dprint 's','h','o','t',' ','1',0,
	set_ailist(CHR_SELF, AILIST_MEETING_CUTSCENE)
	endlist
};

u8 func0403_walk_from_meeting[] = {
	walk_to_pad(PAD_DEPO_0085)

	beginloop(0x04)
		if_chr_stopped(/*goto*/ 0x06)
	endloop(0x04)

	label(0x06)
	remove_chr(CHR_SELF)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func0404_run_from_meeting[] = {
	run_to_pad(PAD_DEPO_0085)

	beginloop(0x04)
		if_chr_stopped(/*goto*/ 0x06)
	endloop(0x04)

	label(0x06)
	remove_chr(CHR_SELF)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func1001_objectives_failed_msg[] = {
	yield
	set_ailist(CHR_SELF, GAILIST_SHOW_OBJ_FAILED_MSG)
	endlist
};

/**
 * Monitor the laser states and unset the stage flags when they become enabled
 * (ie. door is closed). This seems redundant because the flags are unset when
 * the switches are used. Maybe they close after a long timeout or something.
 */
u8 func1017_check_lasers_closed[] = {
	beginloop(0x04)
		if_stage_flag_eq(STAGEFLAG_ALL_LASERS_DISABLED, TRUE, /*goto*/ 0x08)
		if_stage_flag_eq(STAGEFLAG_MEETING_HOLOGRAPHED, TRUE, /*goto*/ 0x08)
		if_door_state(OBJ_LASER_1A, (DOORSTATE_OPEN | DOORSTATE_CLOSING | DOORSTATE_OPENING), /*goto*/ 0x2c)
		unset_stage_flag(STAGEFLAG_LASERSET1_DISABLED)
		label(0x2c)
		if_door_state(OBJ_LASER_2A, (DOORSTATE_OPEN | DOORSTATE_CLOSING | DOORSTATE_OPENING), /*goto*/ 0x2c)
		unset_stage_flag(STAGEFLAG_LASERSET2_DISABLED)
		label(0x2c)
		if_door_state(OBJ_LASER_3A, (DOORSTATE_OPEN | DOORSTATE_CLOSING | DOORSTATE_OPENING), /*goto*/ 0x2c)
		unset_stage_flag(STAGEFLAG_LASERSET3_DISABLED)
		label(0x2c)
		if_door_state(OBJ_LASER_4A, (DOORSTATE_OPEN | DOORSTATE_CLOSING | DOORSTATE_OPENING), /*goto*/ 0x2c)
		unset_stage_flag(STAGEFLAG_LASERSET4_DISABLED)
		label(0x2c)
	endloop(0x04)

	label(0x08)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func040d_intro[] = {
	set_chr_chrflag(CHR_COOP, CHRCFLAG_HIDDEN)
	set_chr_chrflag(CHR_ANTI, CHRCFLAG_HIDDEN)
	play_cutscene_track(MUSIC_G5_INTRO)
	camera_movement(ANIM_CUT_DEPO_INTRO_CAM)
	cmd0175(60)

	set_chr_chrflag(CHR_BOND, CHRCFLAG_UNPLAYABLE)
	set_chr_hiddenflag(CHR_BOND, CHRHFLAG_00020000)
	chr_do_animation(ANIM_CUT_DEPO_INTRO_JO, -1, -1, CHRANIMFLAG_MOVEWHENINVIS | CHRANIMFLAG_PAUSEATEND, 0, CHR_BOND, 4)

	set_chr_chrflag(CHR_INTRO_VICTIM, CHRCFLAG_UNPLAYABLE)
	unset_chr_chrflag(CHR_INTRO_VICTIM, CHRCFLAG_HIDDEN)
	set_chr_hiddenflag(CHR_INTRO_VICTIM, CHRHFLAG_00020000)
	chr_do_animation(ANIM_CUT_DEPO_INTRO_GUARD_01, -1, -1, CHRANIMFLAG_MOVEWHENINVIS | CHRANIMFLAG_PAUSEATEND, 0, CHR_INTRO_VICTIM, 4)

	restart_timer
	set_cutscene_weapon(CHR_BOND, WEAPON_FALCON2_SILENCER, WEAPON_NONE)
	fade_to_color(0x000000ff, 0)
	fade_to_color(0x00000000, 110)

	beginloop(0x55)
		if_controller_button_pressed(/*goto*/ 0x54)
		if_timer_gt(74, /*goto*/ 0x06)
	endloop(0x55)

	label(0x06)
	play_sound(SFX_0161, CHANNEL_7)

	beginloop(0x56)
		if_controller_button_pressed(/*goto*/ 0x54)
		if_timer_gt(100, /*goto*/ 0x06)
	endloop(0x56)

	label(0x06)
	play_sound(SFX_0085, CHANNEL_7)

	beginloop(0x57)
		if_controller_button_pressed(/*goto*/ 0x54)
		if_timer_gt(172, /*goto*/ 0x06)
	endloop(0x57)

	label(0x06)
	play_sound(SFX_0163, CHANNEL_7)

	beginloop(0x58)
		if_controller_button_pressed(/*goto*/ 0x54)
		if_timer_gt(173, /*goto*/ 0x06)
	endloop(0x58)

	label(0x06)
	play_sound(SFX_0164, CHANNEL_6)

	beginloop(0x59)
		if_controller_button_pressed(/*goto*/ 0x54)
		if_timer_gt(278, /*goto*/ 0x06)
	endloop(0x59)

	label(0x06)
	play_sound(SFX_0161, CHANNEL_7)

	beginloop(0x5a)
		if_controller_button_pressed(/*goto*/ 0x54)
		if_timer_gt(312, /*goto*/ 0x06)
	endloop(0x5a)

	label(0x06)
	play_sound(SFX_0162, CHANNEL_7)

	beginloop(0x5b)
		if_controller_button_pressed(/*goto*/ 0x54)
		if_timer_gt(356, /*goto*/ 0x06)
	endloop(0x5b)

	label(0x06)
	play_sound(SFX_0163, CHANNEL_7)

	beginloop(0x5c)
		if_controller_button_pressed(/*goto*/ 0x54)
		if_timer_gt(396, /*goto*/ 0x06)
	endloop(0x5c)

	label(0x06)
	play_sound(SFX_0164, CHANNEL_7)

	beginloop(0x5d)
		if_controller_button_pressed(/*goto*/ 0x54)
		if_timer_gt(434, /*goto*/ 0x06)
	endloop(0x5d)

	label(0x06)
	play_sound(SFX_0161, CHANNEL_7)

	beginloop(0x5e)
		if_controller_button_pressed(/*goto*/ 0x54)
		if_timer_gt(478, /*goto*/ 0x06)
	endloop(0x5e)

	label(0x06)
	play_sound(SFX_0162, CHANNEL_7)

	beginloop(0x60)
		if_controller_button_pressed(/*goto*/ 0x54)
		if_timer_gt(515, /*goto*/ 0x06)
	endloop(0x60)

	label(0x06)
	play_sound(SFX_0163, CHANNEL_7)

	beginloop(0x61)
		if_controller_button_pressed(/*goto*/ 0x54)
		if_timer_gt(560, /*goto*/ 0x06)
	endloop(0x61)

	label(0x06)
	play_sound(SFX_0164, CHANNEL_7)

	beginloop(0x65)
		if_controller_button_pressed(/*goto*/ 0x54)
		if_timer_gt(568, /*goto*/ 0x06)
	endloop(0x65)

	label(0x06)
	play_sound(SFX_0162, CHANNEL_6)

	beginloop(0x62)
		if_controller_button_pressed(/*goto*/ 0x54)
		if_timer_gt(595, /*goto*/ 0x06)
	endloop(0x62)

	label(0x06)
	play_sound(SFX_0161, CHANNEL_7)

	beginloop(0x63)
		if_controller_button_pressed(/*goto*/ 0x54)
		if_timer_gt(630, /*goto*/ 0x06)
	endloop(0x63)

	label(0x06)
	play_sound(SFX_0162, CHANNEL_7)

	beginloop(0x66)
		if_controller_button_pressed(/*goto*/ 0x54)
		if_timer_gt(638, /*goto*/ 0x06)
	endloop(0x66)

	label(0x06)
	play_sound(SFX_0163, CHANNEL_6)

	beginloop(0x68)
		if_controller_button_pressed(/*goto*/ 0x54)
		if_timer_gt(670, /*goto*/ 0x06)
	endloop(0x68)

	label(0x06)
	play_sound(SFX_002E, CHANNEL_7)

	beginloop(0x67)
		if_controller_button_pressed(/*goto*/ 0x54)
		if_timer_gt(670, /*goto*/ 0x06)
	endloop(0x67)

	label(0x06)
	play_sound(SFX_0045, CHANNEL_6)
	chr_drop_weapon(CHR_INTRO_VICTIM)

	beginloop(0x69)
		if_controller_button_pressed(/*goto*/ 0x54)
		if_timer_gt(672, /*goto*/ 0x06)
	endloop(0x69)

	label(0x06)
	play_sound(SFX_ARGH_MALE_0087, CHANNEL_5)

	beginloop(0x64)
		if_controller_button_pressed(/*goto*/ 0x54)
		if_timer_gt(702, /*goto*/ 0x06)
	endloop(0x64)

	label(0x06)
	play_sound(SFX_0164, CHANNEL_6)

	beginloop(0x6a)
		if_controller_button_pressed(/*goto*/ 0x54)
		if_timer_gt(718, /*goto*/ 0x06)
	endloop(0x6a)

	label(0x06)
	play_sound(SFX_007A, CHANNEL_7)

	beginloop(0x6b)
		if_controller_button_pressed(/*goto*/ 0x54)
		if_timer_gt(722, /*goto*/ 0x06)
	endloop(0x6b)

	label(0x06)
	play_sound(SFX_007C, CHANNEL_6)

	beginloop(0x6c)
		if_controller_button_pressed(/*goto*/ 0x54)
		if_timer_gt(764, /*goto*/ 0x06)
	endloop(0x6c)

	label(0x06)
	play_sound(SFX_0082, CHANNEL_5)

	beginloop(0x08)
		if_camera_animating(/*goto*/ 0x2c)
		goto_next(0x54)
		label(0x2c)
		if_controller_button_pressed(/*goto*/ 0x54)
		label(0x2c)
	endloop(0x08)

	label(0x54)
	unset_chr_chrflag(CHR_COOP, CHRCFLAG_HIDDEN)
	unset_chr_chrflag(CHR_ANTI, CHRCFLAG_HIDDEN)
	unset_chr_chrflag(CHR_BOND, CHRCFLAG_UNPLAYABLE)
	set_chr_hiddenflag(CHR_BOND, CHRHFLAG_00020000)
	chr_do_animation(ANIM_CUT_DEPO_INTRO_JO, -2, -1, CHRANIMFLAG_MOVEWHENINVIS | CHRANIMFLAG_PAUSEATEND, 0, CHR_BOND, 2)

	unset_chr_chrflag(CHR_INTRO_VICTIM, CHRCFLAG_UNPLAYABLE)
	set_chr_hiddenflag(CHR_INTRO_VICTIM, CHRHFLAG_00020000)
	set_chr_chrflag(CHR_INTRO_VICTIM, CHRCFLAG_INVINCIBLE)
	set_chr_chrflag(CHR_INTRO_VICTIM, CHRCFLAG_PERIMDISABLEDTMP)
	chr_do_animation(ANIM_CUT_DEPO_INTRO_GUARD_01, -2, -1, CHRANIMFLAG_MOVEWHENINVIS | CHRANIMFLAG_PAUSEATEND, 0, CHR_INTRO_VICTIM, 2)

	stop_cutscene_track
	stop_ambient_track
	enter_firstperson
	chr_do_animation(ANIM_CUT_DEPO_INTRO_GUARD_02, -1, -1, CHRANIMFLAG_MOVEWHENINVIS | CHRANIMFLAG_PAUSEATEND, 0, CHR_INTRO_VICTIM, 2)
	chr_drop_weapon(CHR_INTRO_VICTIM)
	yield
	set_ailist(CHR_CLOAK_1A, AILIST_INIT_CLOAK1_GUARD)
	set_ailist(CHR_CLOAK_1B, AILIST_INIT_CLOAK1_GUARD)
	yield
	kill(CHR_INTRO_VICTIM)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

// Used in both mid and outro cutscenes
#define wait_until(time, loopid) \
	beginloop(loopid) \
		if_controller_button_pressed(/*goto*/ 0x54) \
		if_timer_gt(time, /*goto*/ 0x06) \
	endloop(loopid) \
 \
	label(0x06)

u8 func040e_meeting_cutscene[] = {
	deactivate_alarm
	set_chr_chrflag(CHR_COOP, CHRCFLAG_HIDDEN)
	set_chr_chrflag(CHR_ANTI, CHRCFLAG_HIDDEN)
	play_cutscene_track(MUSIC_G5_MIDCUTSCENE)
	camera_movement(ANIM_CUT_DEPO_MID_CAM)
	set_stage_flag(STAGEFLAG_MEETING_STARTED)
	set_ailist(CHR_BLONDE, GAILIST_IDLE)
	set_ailist(CHR_CASS, GAILIST_IDLE)
	set_ailist(CHR_TRENT, GAILIST_IDLE)
	set_ailist(CHR_STRIPES, GAILIST_IDLE)

	set_chr_chrflag(CHR_BLONDE, CHRCFLAG_UNPLAYABLE)
	unset_chr_chrflag(CHR_BLONDE, CHRCFLAG_HIDDEN)
	set_chr_hiddenflag(CHR_BLONDE, CHRHFLAG_00020000)
	chr_do_animation(ANIM_CUT_DEPO_MID_MRB, -1, -1, CHRANIMFLAG_MOVEWHENINVIS | CHRANIMFLAG_PAUSEATEND, 0, CHR_BLONDE, 4)

	set_chr_chrflag(CHR_CASS, CHRCFLAG_UNPLAYABLE)
	unset_chr_chrflag(CHR_CASS, CHRCFLAG_HIDDEN)
	set_chr_hiddenflag(CHR_CASS, CHRHFLAG_00020000)
	chr_do_animation(ANIM_CUT_DEPO_MID_CASS, -1, -1, CHRANIMFLAG_MOVEWHENINVIS | CHRANIMFLAG_PAUSEATEND, 0, CHR_CASS, 4)

	set_chr_chrflag(CHR_TRENT, CHRCFLAG_UNPLAYABLE)
	unset_chr_chrflag(CHR_TRENT, CHRCFLAG_HIDDEN)
	set_chr_hiddenflag(CHR_TRENT, CHRHFLAG_00020000)
	chr_do_animation(ANIM_CUT_DEPO_MID_TRENT, -1, -1, CHRANIMFLAG_MOVEWHENINVIS | CHRANIMFLAG_PAUSEATEND, 0, CHR_TRENT, 4)

	set_chr_chrflag(CHR_STRIPES, CHRCFLAG_UNPLAYABLE)
	unset_chr_chrflag(CHR_STRIPES, CHRCFLAG_HIDDEN)
	set_chr_hiddenflag(CHR_STRIPES, CHRHFLAG_00020000)
	chr_do_animation(ANIM_CUT_DEPO_MID_STR, -1, -1, CHRANIMFLAG_MOVEWHENINVIS | CHRANIMFLAG_PAUSEATEND, 0, CHR_STRIPES, 4)
	restart_timer

	beginloop(0x55)
		if_timer_gt(240, /*goto*/ 0x06)
	endloop(0x55)

	label(0x06)
	speak(CHR_BOND, L_DEPO_072, MP3_040C, CHANNEL_5, COLOR_04_ORANGE) // "We've recovered the sapient from Carrington and al..."

	wait_until(752, 0x56)
	play_sound(SFX_0161, CHANNEL_6)

	wait_until(760, 0x57)
	speak(CHR_BOND, L_DEPO_073, MP3_040D, CHANNEL_7, COLOR_03_RED) // "This will reduce its efficiency. My team will have..."

	wait_until(813, 0x58)
	play_sound(SFX_0162, CHANNEL_6)

	wait_until(864, 0x59)
	play_sound(SFX_0163, CHANNEL_5)

	wait_until(1183, 0x5a)
	play_sound(SFX_0164, CHANNEL_6)

	wait_until(1466, 0x5b)
	play_sound(SFX_0161, CHANNEL_6)

	// Someone screwed up the labelling here...
	// 5c was probably supposed to go here.
	yield
	if_controller_button_pressed(/*goto*/ 0x54)
	if_timer_gt(1594, /*goto*/ 0x06)
	goto_first(0x5c)
	label(0x06)
	play_sound(SFX_0162, CHANNEL_6)

	wait_until(1638, 0x5c)
	play_sound(SFX_0593, CHANNEL_6)

	wait_until(1684, 0x5d)
	speak(CHR_BOND, L_DEPO_074, MP3_040E, CHANNEL_5, COLOR_04_ORANGE) // "No one could have predicted that! And I resent bei..."

	wait_until(1780, 0x5e)
	play_sound_from_object2(CHANNEL_6, 0x3a, SFX_01D5, PSTYPE_NONE, 0)

	wait_until(2050, 0x60)
	play_sound_from_object2(CHANNEL_7, 0x3a, SFX_00EC, PSTYPE_NONE, 0)

	wait_until(2070, 0x5f)
	open_door(0x3a)
	play_sound_from_object2(0x0a, 0x3a, SFX_DOOR_81B0, PSTYPE_NONE, 0)

	wait_until(2195, 0x61)
	play_sound(SFX_0171, CHANNEL_6)

	wait_until(2227, 0x62)
	play_sound(SFX_0172, CHANNEL_5)

	wait_until(2272, 0x63)
	play_sound(SFX_0173, CHANNEL_7)

	wait_until(2291, 0x64)
	play_sound(SFX_0161, CHANNEL_7)

	wait_until(2316, 0x65)
	speak(CHR_BOND, L_DEPO_075, MP3_040F, CHANNEL_7, COLOR_03_RED) // "The President turned down your request for the loa..."

	wait_until(2342, 0x67)
	play_sound(SFX_0162, CHANNEL_6)
	close_door(0x3a)

	wait_until(2387, 0x68)
	play_sound(SFX_0163, CHANNEL_5)

	wait_until(2406, 0x69)
	play_sound(SFX_0163, CHANNEL_6)

	wait_until(2521, 0x6a)
	play_sound(SFX_0161, CHANNEL_5)

	wait_until(2547, 0x6b)
	play_sound(SFX_0162, CHANNEL_6)

	wait_until(2584, 0x6c)
	play_sound(SFX_0163, CHANNEL_7)

	wait_until(2586, 0x6d)
	play_sound(SFX_0164, CHANNEL_5)

	wait_until(2617, 0x6e)
	play_sound(SFX_0164, CHANNEL_5)

	wait_until(2662, 0x70)
	play_sound(SFX_0162, CHANNEL_6)

	wait_until(2668, 0x71)
	play_sound(SFX_0161, CHANNEL_5)

	wait_until(2692, 0x6f)
	speak(CHR_BOND, L_DEPO_076, MP3_0410, CHANNEL_7, COLOR_03_RED) // "Could it be you overestimated your influence over ..."

	wait_until(2705, 0x72)
	play_sound(SFX_0161, CHANNEL_6)

	wait_until(2713, 0x73)
	play_sound(SFX_0162, CHANNEL_5)

	wait_until(2796, 0x74)
	play_sound(SFX_0161, CHANNEL_6)

	wait_until(2937, 0x75)
	play_sound(SFX_0164, CHANNEL_6)

	wait_until(2971, 0x76)
	play_sound(SFX_0162, CHANNEL_6)

	wait_until(3000, 0x77)
	play_sound(SFX_0162, CHANNEL_6)

	wait_until(3046, 0x78)
	play_sound(SFX_0163, CHANNEL_5)

	wait_until(3048, 0x79)
	speak(CHR_BOND, L_DEPO_077, MP3_0411, CHANNEL_7, COLOR_05_GREEN) // "No! Perhaps I underestimated his resolve. We have ..."

	wait_until(3186, 0x7a)
	play_sound(SFX_0164, CHANNEL_6)

	wait_until(3378, 0x7b)
	play_sound(SFX_0162, CHANNEL_6)

	wait_until(3429, 0x7c)
	play_sound(SFX_0161, CHANNEL_6)

	wait_until(3481, 0x7d)
	play_sound(SFX_0162, CHANNEL_6)

	wait_until(3557, 0x7e)
	play_sound(SFX_0164, CHANNEL_6)

	wait_until(3628, 0x7f)
	play_sound(SFX_0163, CHANNEL_6)

	wait_until(3813, 0x80)
	play_sound(SFX_0161, CHANNEL_6)

	wait_until(3916, 0x81)
	play_sound(SFX_0162, CHANNEL_6)

	wait_until(4070, 0x82)
	speak(CHR_BOND, L_DEPO_078, MP3_0412, CHANNEL_7, COLOR_04_ORANGE) // "Ha! Assuming you don't get any interference. If Ca..."

	wait_until(4312, 0x84)
	play_sound(SFX_0163, CHANNEL_6)

	wait_until(4370, 0x85)
	play_sound(SFX_0164, CHANNEL_5)

	wait_until(4440, 0x86)
	play_sound(SFX_0161, CHANNEL_6)

	wait_until(4510, 0x87)
	play_sound(SFX_0162, CHANNEL_6)

	wait_until(4555, 0x88)
	play_sound(SFX_0161, CHANNEL_7)

	wait_until(4560, 0x83)
	speak(CHR_BOND, L_DEPO_079, MP3_0413, CHANNEL_5, COLOR_05_GREEN) // "There will be no outside help for Mr. Carrington. ..."

	wait_until(4636, 0x89)
	play_sound(SFX_0163, CHANNEL_7)

	wait_until(5017, 0x8a)
	play_sound(SFX_0164, CHANNEL_7)

	wait_until(5272, 0x8b)
	speak(CHR_BOND, L_DEPO_080, MP3_0414, CHANNEL_5, COLOR_03_RED) // "Then the devices we gave you are working correctly..."

	wait_until(5360, 0x8c)
	play_sound(SFX_0163, CHANNEL_6)

	wait_until(5509, 0x8d)
	play_sound(SFX_0164, CHANNEL_6)

	wait_until(5897, 0x8e)
	play_sound(SFX_0161, CHANNEL_6)

	beginloop(0x08)
		if_camera_animating(/*goto*/ 0x2c)
		goto_next(0x54)
		label(0x2c)
		label(0x2c)
	endloop(0x08)

	label(0x54)
	label(0x06)
	stop_cutscene_track
	stop_ambient_track
	enter_firstperson
	set_stage_flag(STAGEFLAG_MEETING_FINISHED)
	mute_channel(CHANNEL_CUTSCENE)
	mute_channel(CHANNEL_7)
	mute_channel(CHANNEL_6)
	mute_channel(CHANNEL_5)
	unset_chr_chrflag(CHR_COOP, CHRCFLAG_HIDDEN)
	unset_chr_chrflag(CHR_ANTI, CHRCFLAG_HIDDEN)
	restart_timer
	label(0x06)
	set_ailist(CHR_CASS, AILIST_WALK_FROM_MEETING)

	beginloop(0x0e)
		if_timer_gt(140, /*goto*/ 0x06)
	endloop(0x0e)

	label(0x06)
	set_ailist(CHR_TRENT, AILIST_WALK_FROM_MEETING)

	beginloop(0x0f)
		if_timer_gt(300, /*goto*/ 0x06)
	endloop(0x0f)

	label(0x06)
	chr_move_to_pad(0x1e, PAD_DEPO_003C, TRUE, /*goto*/ 0x2c) // invalid chr?
	label(0x2c)
	set_ailist(CHR_BLONDE, AILIST_WALK_FROM_MEETING)
	set_ailist(CHR_STRIPES, AILIST_WALK_FROM_MEETING)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func040f_outro_from_menu[] = {
	disable_object(OBJ_MINE1)
	disable_object(OBJ_MINE2)
	set_ailist(CHR_SELF, AILIST_OUTRO)
	endlist
};

u8 func040f_outro[] = {
	camera_movement(ANIM_CUT_DEPO_OUTRO_CAM)
	play_cutscene_track(MUSIC_G5_OUTRO)
	set_chr_chrflag(CHR_ANTI, CHRCFLAG_HIDDEN)
	set_chr_chrflag(CHR_P1P2_OPPOSITE, CHRCFLAG_HIDDEN)
	set_ailist(CHR_P1P2, GAILIST_IDLE)
	set_chr_chrflag(CHR_P1P2, CHRCFLAG_UNPLAYABLE)
#if VERSION >= VERSION_NTSC_1_0
	unset_chr_chrflag(CHR_P1P2, CHRCFLAG_HIDDEN)
#endif
	set_chr_hiddenflag(CHR_P1P2, CHRHFLAG_00020000)
	chr_do_animation(ANIM_CUT_DEPO_OUTRO_JO, -1, -1, CHRANIMFLAG_MOVEWHENINVIS | CHRANIMFLAG_PAUSEATEND, 0, CHR_P1P2, 4)
	set_chr_hudpiece_visible(CHR_P1P2, TRUE)
	restart_timer
	deactivate_alarm
	show_nonessential_chrs(FALSE)
	set_cutscene_weapon(CHR_P1P2, -1, -1)
	yield
	set_cutscene_weapon(CHR_P1P2, -1, WEAPON_FALCON2_SILENCER)

	wait_until(20, 0x55)
	play_sound(SFX_0171, CHANNEL_6)

	wait_until(38, 0x57)
	play_sound(SFX_0173, CHANNEL_7)

	wait_until(69, 0x58)
	play_sound(SFX_0174, CHANNEL_6)

	wait_until(88, 0x5a)
	play_sound(SFX_0172, CHANNEL_6)

	wait_until(103, 0x5b)
	play_sound(SFX_0173, CHANNEL_7)

	wait_until(134, 0x5c)
	play_sound(SFX_0174, CHANNEL_6)

	wait_until(142, 0x5e)

	wait_until(162, 0x60)
	play_sound(SFX_0173, CHANNEL_7)

	wait_until(185, 0x61)
	play_sound(SFX_0174, CHANNEL_6)

	wait_until(204, 0x62)
	play_sound(SFX_0171, CHANNEL_7)

	wait_until(220, 0x63)
	play_sound(SFX_0172, CHANNEL_6)

	wait_until(256, 0x64)
	play_sound(SFX_0173, CHANNEL_7)

	wait_until(262, 0x65)
	play_sound(SFX_0174, CHANNEL_6)

	enable_rain(2)
	wait_until(273, 0x68)
	play_sound(SFX_0172, CHANNEL_7)

	wait_until(318, 0x6a)
	play_sound(SFX_0174, CHANNEL_6)

	wait_until(344, 0x6b)
	play_sound(SFX_0171, CHANNEL_7)

	wait_until(362, 0x6c)
	play_sound(SFX_0172, CHANNEL_6)

	wait_until(390, 0x6d)
	play_sound(SFX_0163, CHANNEL_7)

	wait_until(404, 0x6e)
	play_sound(SFX_0161, CHANNEL_6)

	wait_until(420, 0x70)
	play_sound(SFX_0162, CHANNEL_6)

	wait_until(468, 0x71)
	play_sound(SFX_0163, CHANNEL_7)

	wait_until(488, 0x72)
	play_sound(SFX_0164, CHANNEL_6)

	wait_until(679, 0x74)
	play_sound(SFX_0161, CHANNEL_6)

	wait_until(728, 0x56)

	wait_until(768, 0x73)
	speak(CHR_P1P2, L_DEPO_081, MP3_0415, CHANNEL_7, COLOR_09_BLUE) // "Agent Dark reporting in! Prepare to receive a down..."

	wait_until(1280, 0x59)

	wait_until(1310, 0x75)
	speak(CHR_P1P2, L_DEPO_082, MP3_0416, CHANNEL_7, COLOR_06_WHITE) // "No time for that now, Agent Dark. There's been a d..."

	wait_until(1780, 0x76)
	play_sound(SFX_0162, CHANNEL_6)

	wait_until(1841, 0x77)
	play_sound(SFX_0163, CHANNEL_6)

	wait_until(1883, 0x78)
	play_sound(SFX_0164, CHANNEL_6)

	wait_until(2600, 0x5d)

	wait_until(2630, 0x79)
	speak(CHR_P1P2, L_DEPO_083, MP3_0417, CHANNEL_7, COLOR_09_BLUE) // "Area 51? But what about the President?"

	beginloop(0x08)
		if_camera_animating(/*goto*/ 0x2c)
		goto_next(0x54)
		label(0x2c)
		if_controller_button_pressed(/*goto*/ 0x54)
		label(0x2c)
	endloop(0x08)

	label(0x54)
	label(0x06)
	set_chr_hudpiece_visible(CHR_P1P2, FALSE)
	end_level
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func1018_intro_from_menu[] = {
	set_returnlist(CHR_SELF, GAILIST_END_CINEMA)
	set_ailist(CHR_SELF, AILIST_INTRO)
	endlist
};

u8 func1019_generator_hum[] = {
	yield
	assign_sound(SFX_8146, CHANNEL_4)
	play_repeating_sound_from_object(CHANNEL_4, OBJ_GENERATOR, 1, 1600, 2200)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

/**
 * Not entirely sure what this does. It's probably the guards in the laser
 * switch area, and it probably controls which ones will run for the alarm.
 */
u8 func101a_init_laser_switch_guards[] = {
	if_difficulty_lt(DIFF_SA, /*goto*/ 0x08)
	if_difficulty_lt(DIFF_PA, /*goto*/ 0x09)

	// Perfect Agent
	set_chr_flag_bankx(0x0c, CHRFLAG0_ACTIVATEALARM, BANK_0)
	set_chr_flag_bankx(0x0d, CHRFLAG0_ACTIVATEALARM, BANK_0)
	set_chr_flag_bankx(0x0e, CHRFLAG0_ACTIVATEALARM, BANK_0)
	goto_next(0x06)

	// Agent
	label(0x08)
	set_chr_flag_bankx(0x0e, CHRFLAG0_ACTIVATEALARM, BANK_0)
	set_chr_flag_bankx(0x0e, CHRFLAG0_SURPRISABLE, BANK_0)
	goto_next(0x06)

	// Special Agent
	label(0x09)
	set_chr_flag_bankx(0x0e, CHRFLAG0_ACTIVATEALARM, BANK_0)
	set_chr_flag_bankx(0x0d, CHRFLAG0_ACTIVATEALARM, BANK_0)

	label(0x06)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func0412_cloak_guard[] = {
	set_morale(0)
	set_shotlist(AILIST_CLOAK_GUARD)
	set_chr_cloaked(CHR_SELF, TRUE, FALSE)
	if_chr_dead(CHR_SELF, /*goto*/ 0x06)
	if_chr_death_animation_finished(CHR_SELF, /*goto*/ 0x06)
	if_chr_knockedout(CHR_SELF, /*goto*/ 0x06)
	goto_next(0x03)

	// Dead
	label(0x06)
	goto_next(0x10)

	// Choose target
	label(0x03)
		chr_toggle_p1p2(CHR_SELF)
		set_target_chr(CHR_P1P2)
		label(0x06)
		restart_timer
		cmd0139(70, 0x02, TRUE)

		// Wait 3 seconds or until stopped
		beginloop(0x55)
			if_timer_gt(180, /*goto*/ 0x06)
			if_chr_stopped(/*goto*/ 0x06)
		endloop(0x55)

		// 50% chance of attacking immediately, 50% at 2 seconds
		label(0x06)
		stop_chr
		call_rng
		if_rand_gt(128, /*goto*/ 0x06)
		restart_timer

		beginloop(0x0e)
			if_timer_gt(120, /*goto*/ 0x06)
		endloop(0x0e)

		// Attacking
		label(0x06)
		if_morale_lt(3, /*goto*/ 0x2c)
		goto_next(0x06)

		label(0x2c)
		if_within_targets_fovx_by_angle(15, /*goto*/ 0x0e)
		label(0x06)
		if_can_see_attack_target(/*goto*/ 0x2c)
		goto_next(0x0d)
		label(0x0e)
		add_morale(1)
		label(0x2c)
		restart_timer
		set_chr_cloaked(CHR_SELF, FALSE, TRUE)
		label(0x0a)
		label(0x2c)
		try_attack_stand(ATTACKFLAG_AIMATTARGET | ATTACKFLAG_AIMONLY, 0, /*goto*/ 0x2c)
		label(0x2c)
		try_modify_attack(ATTACKFLAG_AIMATTARGET, 0, /*goto*/ 0x0b)

		beginloop(0x0b)
			if_chr_stopped(/*goto*/ 0x0c)
		endloop(0x0b)

		label(0x0c)
		set_morale(0)
		set_chr_cloaked(CHR_SELF, TRUE, TRUE)
		label(0x0d)
	goto_first(0x03)

	label(0x10)
	if_chr_has_hiddenflag(CHR_SELF, CHRHFLAG_CLOAKED, /*goto*/ 0x2c)
	set_ailist(CHR_SELF, GAILIST_IDLE)

	label(0x2c)
	set_chr_cloaked(CHR_SELF, FALSE, TRUE)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func0413_cloak1_guard[] = {
	yield
	set_shotlist(AILIST_CLOAK_GUARD)
	set_self_chrflag(CHRCFLAG_INVINCIBLE)
	label(0x06)
	set_reaction_speed(100)
	set_shotlist(AILIST_CLOAK_GUARD)
	restart_timer

	beginloop(0x04)
		chr_toggle_p1p2(CHR_SELF)
		set_target_chr(CHR_P1P2)
		if_distance_to_target_lt(400, /*goto*/ 0x06)
		if_target_in_fov(30, /*goto*/ 0x06)
		if_target_aiming_at_me(/*goto*/ 0x06)
		if_difficulty_lt(DIFF_SA, /*goto*/ 0x2c)
		if_timer_gt(180, /*goto*/ 0x06)
		label(0x2c)
	endloop(0x04)

	label(0x06)
	unset_self_chrflag(CHRCFLAG_INVINCIBLE)
	set_self_chrflag(CHRCFLAG_NEVERSLEEP)
	set_chr_cloaked(CHR_SELF, TRUE, TRUE)
	set_ailist(CHR_SELF, AILIST_CLOAK_GUARD)
	endlist
};

u8 func0414_init_cloak2_guard[] = {
	stop_chr
	set_shotlist(AILIST_CLOAK_GUARD)
	set_self_chrflag(CHRCFLAG_INVINCIBLE)
	set_chr_dodge_rating(2, 10)
	set_accuracy(5)
	set_reaction_speed(25)
	set_chr_maxdamage(CHR_SELF, 40)
	add_health_or_armor(0)
	set_recovery_speed(0)
	set_shield(0)
	unset_self_chrflag(CHRCFLAG_INVINCIBLE)
	set_self_chrflag(CHRCFLAG_NEVERSLEEP)
	set_chr_cloaked(CHR_SELF, TRUE, TRUE)
	set_ailist(CHR_SELF, AILIST_CLOAK_GUARD)
	endlist
};

u8 func101b_cloak2_entry[] = {
	// Wait until in glass area of second cloak room
	beginloop(0x08)
		chr_toggle_p1p2(CHR_SELF)
		if_chr_in_room(CHR_P1P2, 0x00, 0x001a, /*goto*/ 0x06)
#if VERSION < VERSION_NTSC_1_0
		if_chr_in_room(0x00, /*camspy*/ 0x02, 0x001a, /*goto*/ 0x06)
#endif
	endloop(0x08)

	label(0x06)
	lock_door(0x34, 0x10)
	lock_door(0x35, 0x10)
	lock_door(0x36, 0x10)
	lock_door(0x37, 0x10)
	set_object_flag2(0x34, OBJFLAG2_LOCKEDBACK)
	set_object_flag2(0x35, OBJFLAG2_LOCKEDBACK)
	set_object_flag2(0x36, OBJFLAG2_LOCKEDFRONT)
	set_object_flag2(0x37, OBJFLAG2_LOCKEDBACK)
	close_door(0x34)
	close_door(0x35)
	close_door(0x36)
	close_door(0x37)
	if_stage_flag_eq(STAGEFLAG_LIGHTS_OFF, TRUE, /*goto*/ 0x2c)
	play_sound(SFX_8147, -1)
	restart_timer
	set_lights_state(0x000b, LIGHTOP_TRANSITION, 255, 6, 120)
	set_lights_state(0x000c, LIGHTOP_TRANSITION, 255, 6, 120)
	set_lights_state(0x000d, LIGHTOP_TRANSITION, 255, 6, 120)
	set_lights_state(0x000e, LIGHTOP_TRANSITION, 255, 6, 120)
	set_lights_state(0x0010, LIGHTOP_TRANSITION, 255, 6, 120)
	set_lights_state(0x000f, LIGHTOP_TRANSITION, 255, 6, 120)
	set_lights_state(0x0011, LIGHTOP_TRANSITION, 255, 6, 120)
	set_lights_state(0x0012, LIGHTOP_TRANSITION, 255, 6, 120)
	set_lights_state(0x0013, LIGHTOP_TRANSITION, 255, 6, 120)
	set_lights_state(0x0014, LIGHTOP_TRANSITION, 255, 6, 120)
	set_lights_state(0x0015, LIGHTOP_TRANSITION, 255, 6, 120)
	set_lights_state(0x0017, LIGHTOP_TRANSITION, 255, 6, 120)
	set_lights_state(0x0018, LIGHTOP_TRANSITION, 255, 6, 120)
	set_lights_state(0x0001, LIGHTOP_TRANSITION, 255, 6, 120)
	set_lights_state(0x0003, LIGHTOP_TRANSITION, 255, 6, 120)
	set_lights_state(0x0004, LIGHTOP_TRANSITION, 255, 6, 120)
	set_lights_state(0x0005, LIGHTOP_TRANSITION, 255, 6, 120)
	set_lights_state(0x0006, LIGHTOP_TRANSITION, 255, 6, 120)
	set_lights_state(0x0007, LIGHTOP_TRANSITION, 255, 6, 120)
	set_lights_state(0x0008, LIGHTOP_TRANSITION, 255, 6, 120)
	set_lights_state(0x0009, LIGHTOP_TRANSITION, 255, 6, 120)
	set_lights_state(0x000a, LIGHTOP_TRANSITION, 255, 6, 120)

	// Wait 2 seconds
	beginloop(0x09)
		if_timer_gt(120, /*goto*/ 0x06)
	endloop(0x09)

	label(0x06)
	set_lights_state(0x000b, LIGHTOP_SET, 10, 0, 0)
	set_lights_state(0x000c, LIGHTOP_SET, 10, 0, 0)
	set_lights_state(0x000d, LIGHTOP_SET, 10, 0, 0)
	set_lights_state(0x000e, LIGHTOP_SET, 10, 0, 0)
	set_lights_state(0x0010, LIGHTOP_SET, 10, 0, 0)
	set_lights_state(0x000f, LIGHTOP_SET, 10, 0, 0)
	set_lights_state(0x0011, LIGHTOP_SET, 10, 0, 0)
	set_lights_state(0x0012, LIGHTOP_SET, 10, 0, 0)
	set_lights_state(0x0013, LIGHTOP_SET, 10, 0, 0)
	set_lights_state(0x0014, LIGHTOP_SET, 10, 0, 0)
	set_lights_state(0x0015, LIGHTOP_SET, 10, 0, 0)
	set_lights_state(0x0017, LIGHTOP_SET, 10, 0, 0)
	set_lights_state(0x0018, LIGHTOP_SET, 10, 0, 0)
	set_lights_state(0x0001, LIGHTOP_SET, 10, 0, 0)
	set_lights_state(0x0003, LIGHTOP_SET, 10, 0, 0)
	set_lights_state(0x0004, LIGHTOP_SET, 10, 0, 0)
	set_lights_state(0x0005, LIGHTOP_SET, 10, 0, 0)
	set_lights_state(0x0006, LIGHTOP_SET, 10, 0, 0)
	set_lights_state(0x0007, LIGHTOP_SET, 10, 0, 0)
	set_lights_state(0x0008, LIGHTOP_SET, 10, 0, 0)
	set_lights_state(0x0009, LIGHTOP_SET, 10, 0, 0)
	set_lights_state(0x000a, LIGHTOP_SET, 10, 0, 0)
	goto_next(0x07)

	label(0x2c)
	play_sound(SFX_8148, -1)
	set_lights_state(0x000b, LIGHTOP_TRANSITION, 6, 255, 120)
	set_lights_state(0x000c, LIGHTOP_TRANSITION, 6, 255, 120)
	set_lights_state(0x000d, LIGHTOP_TRANSITION, 6, 255, 120)
	set_lights_state(0x000e, LIGHTOP_TRANSITION, 6, 255, 120)
	set_lights_state(0x0010, LIGHTOP_TRANSITION, 6, 255, 120)
	set_lights_state(0x000f, LIGHTOP_TRANSITION, 6, 255, 120)
	set_lights_state(0x0011, LIGHTOP_TRANSITION, 6, 255, 120)
	set_lights_state(0x0012, LIGHTOP_TRANSITION, 6, 255, 120)
	set_lights_state(0x0013, LIGHTOP_TRANSITION, 6, 255, 120)
	set_lights_state(0x0014, LIGHTOP_TRANSITION, 6, 255, 120)
	set_lights_state(0x0015, LIGHTOP_TRANSITION, 6, 255, 120)
	set_lights_state(0x0017, LIGHTOP_TRANSITION, 6, 255, 120)
	set_lights_state(0x0018, LIGHTOP_TRANSITION, 6, 255, 120)
	set_lights_state(0x0001, LIGHTOP_TRANSITION, 6, 255, 120)
	set_lights_state(0x0003, LIGHTOP_TRANSITION, 6, 255, 120)
	set_lights_state(0x0004, LIGHTOP_TRANSITION, 6, 255, 120)
	set_lights_state(0x0005, LIGHTOP_TRANSITION, 6, 255, 120)
	set_lights_state(0x0006, LIGHTOP_TRANSITION, 6, 255, 120)
	set_lights_state(0x0007, LIGHTOP_TRANSITION, 6, 255, 120)
	set_lights_state(0x0008, LIGHTOP_TRANSITION, 6, 255, 120)
	set_lights_state(0x0009, LIGHTOP_TRANSITION, 6, 255, 120)
	set_lights_state(0x000a, LIGHTOP_TRANSITION, 6, 255, 120)

	// Wait 2 seconds
	restart_timer

	beginloop(0x0a)
		if_timer_gt(120, /*goto*/ 0x06)
	endloop(0x0a)

	label(0x06)
	set_lights_state(0x000b, LIGHTOP_SET, 255, 0, 0)
	set_lights_state(0x000c, LIGHTOP_SET, 255, 0, 0)
	set_lights_state(0x000d, LIGHTOP_SET, 255, 0, 0)
	set_lights_state(0x000e, LIGHTOP_SET, 255, 0, 0)
	set_lights_state(0x0010, LIGHTOP_SET, 255, 0, 0)
	set_lights_state(0x000f, LIGHTOP_SET, 255, 0, 0)
	set_lights_state(0x0011, LIGHTOP_SET, 255, 0, 0)
	set_lights_state(0x0012, LIGHTOP_SET, 255, 0, 0)
	set_lights_state(0x0013, LIGHTOP_SET, 255, 0, 0)
	set_lights_state(0x0014, LIGHTOP_SET, 255, 0, 0)
	set_lights_state(0x0015, LIGHTOP_SET, 255, 0, 0)
	set_lights_state(0x0017, LIGHTOP_SET, 255, 0, 0)
	set_lights_state(0x0018, LIGHTOP_SET, 255, 0, 0)
	set_lights_state(0x0001, LIGHTOP_SET, 255, 0, 0)
	set_lights_state(0x0003, LIGHTOP_SET, 255, 0, 0)
	set_lights_state(0x0004, LIGHTOP_SET, 255, 0, 0)
	set_lights_state(0x0005, LIGHTOP_SET, 255, 0, 0)
	set_lights_state(0x0006, LIGHTOP_SET, 255, 0, 0)
	set_lights_state(0x0007, LIGHTOP_SET, 255, 0, 0)
	set_lights_state(0x0008, LIGHTOP_SET, 255, 0, 0)
	set_lights_state(0x0009, LIGHTOP_SET, 255, 0, 0)
	set_lights_state(0x000a, LIGHTOP_SET, 255, 0, 0)

	label(0x07)
	unset_chr_chrflag(CHR_CLOAK_2A, CHRCFLAG_HIDDEN)
	unset_chr_chrflag(CHR_CLOAK_2B, CHRCFLAG_HIDDEN)
	unset_chr_chrflag(CHR_CLOAK_2C, CHRCFLAG_HIDDEN)
	unset_chr_chrflag(CHR_CLOAK_2D, CHRCFLAG_HIDDEN)
	set_ailist(CHR_CLOAK_2A, AILIST_CLOAK2_GUARD)
	set_ailist(CHR_CLOAK_2B, AILIST_CLOAK2_GUARD)
	set_ailist(CHR_CLOAK_2C, AILIST_CLOAK2_GUARD)
	set_ailist(CHR_CLOAK_2D, AILIST_CLOAK2_GUARD)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func0405_cloak2_hide[] = {
	set_self_chrflag(CHRCFLAG_HIDDEN)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func101c_check_visited_top_door[] = {
	// Wait until decoder attached
	beginloop(0x04)
		if_stage_flag_eq(STAGEFLAG_DECODER_ATTACHED, TRUE, /*goto*/ 0x08)
	endloop(0x04)

	// Wait until player gone near top fire escape door
	beginloop(0x08)
		chr_toggle_p1p2(CHR_SELF)
		if_chr_distance_to_pad_lt(CHR_P1P2, 400, PAD_DEPO_0058, /*goto*/ 0x06)
	endloop(0x08)

	label(0x06)
	set_stage_flag(STAGEFLAG_VISITED_TOP_DOOR)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func101d_init_mines[] = {
	yield
	set_object_flag2(OBJ_MINE1, OBJFLAG2_DONTPAUSE)
	set_object_flag2(OBJ_MINE2, OBJFLAG2_DONTPAUSE)
	set_object_flag2(OBJ_MINE1, OBJFLAG2_INVISIBLE)
	set_object_flag2(OBJ_MINE2, OBJFLAG2_INVISIBLE)
	unset_object_flag(OBJ_MINE1, OBJFLAG_00000100)
	unset_object_flag(OBJ_MINE2, OBJFLAG_00000100)
	set_chr_team(CHR_ANTI, TEAM_ENEMY)

	label(0x06)
	if_savefile_flag_is_unset(GAMEFILEFLAG_G5_MINE, /*goto*/ 0x06)

	disable_object(OBJ_MINE1)
	dprint 'E','P','R','O','M','F','L','A','G',' ','N','O','T','S','E','T',0,
	set_ailist(CHR_SELF, GAILIST_IDLE)

	label(0x06)
	dprint 'E','P','R','O','M','F','L','A','G',' ','S','E','T',0,
	disable_object(OBJ_MINE2)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

#define init_guard(accuracy, reaction, function) \
	set_chr_dodge_rating(2, 10) \
	set_accuracy(accuracy) \
	set_reaction_speed(reaction) \
	set_chr_maxdamage(CHR_SELF, 40) \
	add_health_or_armor(0) \
	set_recovery_speed(0) \
	set_shield(0) \
	set_ailist(CHR_SELF, function)

u8 func0406_init_type1_guard[] = {
	init_guard(5, 30, GAILIST_UNALERTED)
	endlist
};

// Never assigned
u8 func0407_init_type2_guard[] = {
	init_guard(15, 25, GAILIST_UNALERTED)
	endlist
};

u8 func0408_init_cloak1_guard[] = {
	init_guard(5, 25, 0x0413)
	endlist
};

u8 func101e_msg_nowaythrough[] = {
	beginloop(0x04)
		chr_toggle_p1p2(CHR_SELF)
		if_stage_flag_eq(STAGEFLAG_LASERSET1_DISABLED, FALSE, /*goto*/ 0x2c)
		if_stage_flag_eq(STAGEFLAG_LASERSET2_DISABLED, FALSE, /*goto*/ 0x2c)
		if_stage_flag_eq(STAGEFLAG_LASERSET3_DISABLED, FALSE, /*goto*/ 0x2c)
		if_stage_flag_eq(STAGEFLAG_LASERSET4_DISABLED, FALSE, /*goto*/ 0x2c)
		reloop(0x04)

		label(0x2c)
		if_chr_in_room(CHR_P1P2, 0x00, 0x002f, /*goto*/ 0x2c)
	endloop(0x04)

	label(0x2c)
	speak(CHR_P1P2, L_DEPO_060, MP3_03B4, CHANNEL_6, COLOR_09_BLUE) // "There's no way through while those lasers are acti..."
	label(0x0d)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func101f_msg_meetingroomahead[] = {
	restart_timer

	beginloop(0x04)
		if_stage_flag_eq(STAGEFLAG_MEETING_HOLOGRAPHED, TRUE, /*goto*/ 0x0d)
		chr_toggle_p1p2(CHR_SELF)
		if_chr_in_room(CHR_P1P2, 0x00, 0x004c, /*goto*/ 0x2c)
		reloop(0x04)

		label(0x2c)
		if_chr_y(CHR_P1P2, 300, OPERATOR_LESS_THAN, /*goto*/ 0x06)
		goto_next(0x2c)
		label(0x06)
	endloop(0x04)

	label(0x2c)
	speak(CHR_P1P2, L_DEPO_061, MP3_03B5, CHANNEL_6, COLOR_09_BLUE) // "That must be the meeting room up ahead. Time to us..."

	label(0x0d)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func1020_msg_heavilyencrypted[] = {
	beginloop(0x04)
		chr_toggle_p1p2(CHR_SELF)
		if_chr_in_room(CHR_P1P2, 0x00, 0x0050, /*goto*/ 0x2c)
	endloop(0x04)

	label(0x2c)
	speak(CHR_P1P2, L_DEPO_062, SFX_817C, CHANNEL_6, COLOR_09_BLUE) // "The safe's heavily encrypted. The decoder's gonna ..."
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func1021_blow_mines[] = {
	// Wait for backup collected
	beginloop(0x04)
		chr_toggle_p1p2(CHR_SELF)
		if_stage_flag_eq(STAGEFLAG_BACKUP_COLLECTED, TRUE, /*goto*/ 0x2c)
	endloop(0x04)

	// Wait 2 seconds
	label(0x2c)
	restart_timer

	beginloop(0x08)
		if_timer_gt(120, /*goto*/ 0x2c)
	endloop(0x08)

	label(0x2c)
	if_difficulty_lt(DIFF_SA, /*goto*/ 0x2c)
	speak(CHR_P1P2, L_DEPO_063, MP3_03B7, CHANNEL_6, COLOR_09_BLUE) // "Time to leave! Let's get to the door I set up earl..."
	set_ailist(CHR_SELF, GAILIST_IDLE)

	// Agent
	label(0x2c)
	if_object_in_good_condition(OBJ_ESCAPEDOOR1, /*goto*/ 0x2c)
	goto_next(0x0d)

	label(0x2c)
	if_object_in_good_condition(OBJ_ESCAPEDOOR2, /*goto*/ 0x2c)
	goto_next(0x0d)

	label(0x2c)
	speak(CHR_P1P2, L_DEPO_065, SFX_81A2, CHANNEL_6, COLOR_09_BLUE) // "Stand back, Joanna. We'll create your escape route..."
	restart_timer

	beginloop(0x09)
		if_timer_gt(120, /*goto*/ 0x2c)
	endloop(0x09)

	label(0x2c)
	destroy_object(OBJ_MINE1)
	destroy_object(OBJ_MINE2)
	restart_timer

	beginloop(0x0a)
		if_timer_gt(240, /*goto*/ 0x2c)
	endloop(0x0a)

	label(0x2c)
	label(0x0d)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func1022_light_switch[] = {
	beginloop(0x04)
		chr_toggle_p1p2(CHR_SELF)
		if_chr_activated_object(CHR_P1P2, OBJ_LIGHTSWITCH, /*goto*/ 0x2c)
		reloop(0x04)

		label(0x2c)
		if_stage_flag_eq(STAGEFLAG_LIGHTS_OFF, TRUE, /*goto*/ 0x2c)

		// Turning lights off
		set_stage_flag(STAGEFLAG_LIGHTS_OFF)
		assign_sound(SFX_043F, CHANNEL_7)
		play_sound_from_entity(CHANNEL_7, OBJ_LIGHTSWITCH, 0x012c, 0x0190, 0x00)
		yield
		set_object_image(OBJ_LIGHTSWITCH, 0, TVCMDLIST_14)
		play_sound(SFX_8147, -1)
		set_lights_state(0x000b, LIGHTOP_TRANSITION, 255, 6, 120)
		set_lights_state(0x000c, LIGHTOP_TRANSITION, 255, 6, 120)
		set_lights_state(0x000d, LIGHTOP_TRANSITION, 255, 6, 120)
		set_lights_state(0x000e, LIGHTOP_TRANSITION, 255, 6, 120)
		set_lights_state(0x0010, LIGHTOP_TRANSITION, 255, 6, 120)
		set_lights_state(0x000f, LIGHTOP_TRANSITION, 255, 6, 120)
		set_lights_state(0x0011, LIGHTOP_TRANSITION, 255, 6, 120)
		set_lights_state(0x0012, LIGHTOP_TRANSITION, 255, 6, 120)
		set_lights_state(0x0013, LIGHTOP_TRANSITION, 255, 6, 120)
		set_lights_state(0x0014, LIGHTOP_TRANSITION, 255, 6, 120)
		set_lights_state(0x0015, LIGHTOP_TRANSITION, 255, 6, 120)
		set_lights_state(0x0017, LIGHTOP_TRANSITION, 255, 6, 120)
		set_lights_state(0x0018, LIGHTOP_TRANSITION, 255, 6, 120)
		set_lights_state(0x0001, LIGHTOP_TRANSITION, 255, 6, 120)
		set_lights_state(0x0003, LIGHTOP_TRANSITION, 255, 6, 120)
		set_lights_state(0x0004, LIGHTOP_TRANSITION, 255, 6, 120)
		set_lights_state(0x0005, LIGHTOP_TRANSITION, 255, 6, 120)
		set_lights_state(0x0006, LIGHTOP_TRANSITION, 255, 6, 120)
		set_lights_state(0x0007, LIGHTOP_TRANSITION, 255, 6, 120)
		set_lights_state(0x0008, LIGHTOP_TRANSITION, 255, 6, 120)
		set_lights_state(0x0009, LIGHTOP_TRANSITION, 255, 6, 120)
		set_lights_state(0x000a, LIGHTOP_TRANSITION, 255, 6, 120)

		restart_timer

		beginloop(0x09)
			if_timer_gt(120, /*goto*/ 0x06)
		endloop(0x09)

		label(0x06)
		set_lights_state(0x000b, LIGHTOP_SET, 10, 0, 0)
		set_lights_state(0x000c, LIGHTOP_SET, 10, 0, 0)
		set_lights_state(0x000d, LIGHTOP_SET, 10, 0, 0)
		set_lights_state(0x000e, LIGHTOP_SET, 10, 0, 0)
		set_lights_state(0x0010, LIGHTOP_SET, 10, 0, 0)
		set_lights_state(0x000f, LIGHTOP_SET, 10, 0, 0)
		set_lights_state(0x0011, LIGHTOP_SET, 10, 0, 0)
		set_lights_state(0x0012, LIGHTOP_SET, 10, 0, 0)
		set_lights_state(0x0013, LIGHTOP_SET, 10, 0, 0)
		set_lights_state(0x0014, LIGHTOP_SET, 10, 0, 0)
		set_lights_state(0x0015, LIGHTOP_SET, 10, 0, 0)
		set_lights_state(0x0017, LIGHTOP_SET, 10, 0, 0)
		set_lights_state(0x0018, LIGHTOP_SET, 10, 0, 0)
		set_lights_state(0x0001, LIGHTOP_SET, 10, 0, 0)
		set_lights_state(0x0003, LIGHTOP_SET, 10, 0, 0)
		set_lights_state(0x0004, LIGHTOP_SET, 10, 0, 0)
		set_lights_state(0x0005, LIGHTOP_SET, 10, 0, 0)
		set_lights_state(0x0006, LIGHTOP_SET, 10, 0, 0)
		set_lights_state(0x0007, LIGHTOP_SET, 10, 0, 0)
		set_lights_state(0x0008, LIGHTOP_SET, 10, 0, 0)
		set_lights_state(0x0009, LIGHTOP_SET, 10, 0, 0)
		set_lights_state(0x000a, LIGHTOP_SET, 10, 0, 0)
		goto_first(0x04)

		// Turning lights on
		label(0x2c)
		unset_stage_flag(STAGEFLAG_LIGHTS_OFF)
		assign_sound(SFX_043F, CHANNEL_7)
		play_sound_from_entity(CHANNEL_7, OBJ_LIGHTSWITCH, 0x012c, 0x0190, 0x00)
		yield
		play_sound(SFX_8148, -1)
		set_object_image(0x3d, 0, TVCMDLIST_06)
		set_lights_state(0x000b, LIGHTOP_TRANSITION, 6, 255, 120)
		set_lights_state(0x000c, LIGHTOP_TRANSITION, 6, 255, 120)
		set_lights_state(0x000d, LIGHTOP_TRANSITION, 6, 255, 120)
		set_lights_state(0x000e, LIGHTOP_TRANSITION, 6, 255, 120)
		set_lights_state(0x0010, LIGHTOP_TRANSITION, 6, 255, 120)
		set_lights_state(0x000f, LIGHTOP_TRANSITION, 6, 255, 120)
		set_lights_state(0x0011, LIGHTOP_TRANSITION, 6, 255, 120)
		set_lights_state(0x0012, LIGHTOP_TRANSITION, 6, 255, 120)
		set_lights_state(0x0013, LIGHTOP_TRANSITION, 6, 255, 120)
		set_lights_state(0x0014, LIGHTOP_TRANSITION, 6, 255, 120)
		set_lights_state(0x0015, LIGHTOP_TRANSITION, 6, 255, 120)
		set_lights_state(0x0017, LIGHTOP_TRANSITION, 6, 255, 120)
		set_lights_state(0x0018, LIGHTOP_TRANSITION, 6, 255, 120)
		set_lights_state(0x0001, LIGHTOP_TRANSITION, 6, 255, 120)
		set_lights_state(0x0003, LIGHTOP_TRANSITION, 6, 255, 120)
		set_lights_state(0x0004, LIGHTOP_TRANSITION, 6, 255, 120)
		set_lights_state(0x0005, LIGHTOP_TRANSITION, 6, 255, 120)
		set_lights_state(0x0006, LIGHTOP_TRANSITION, 6, 255, 120)
		set_lights_state(0x0007, LIGHTOP_TRANSITION, 6, 255, 120)
		set_lights_state(0x0008, LIGHTOP_TRANSITION, 6, 255, 120)
		set_lights_state(0x0009, LIGHTOP_TRANSITION, 6, 255, 120)
		set_lights_state(0x000a, LIGHTOP_TRANSITION, 6, 255, 120)

		restart_timer

		beginloop(0x0a)
			if_timer_gt(120, /*goto*/ 0x06)
		endloop(0x0a)

		label(0x06)
		set_lights_state(0x000b, LIGHTOP_SET, 255, 0, 0)
		set_lights_state(0x000c, LIGHTOP_SET, 255, 0, 0)
		set_lights_state(0x000d, LIGHTOP_SET, 255, 0, 0)
		set_lights_state(0x000e, LIGHTOP_SET, 255, 0, 0)
		set_lights_state(0x0010, LIGHTOP_SET, 255, 0, 0)
		set_lights_state(0x000f, LIGHTOP_SET, 255, 0, 0)
		set_lights_state(0x0011, LIGHTOP_SET, 255, 0, 0)
		set_lights_state(0x0012, LIGHTOP_SET, 255, 0, 0)
		set_lights_state(0x0013, LIGHTOP_SET, 255, 0, 0)
		set_lights_state(0x0014, LIGHTOP_SET, 255, 0, 0)
		set_lights_state(0x0015, LIGHTOP_SET, 255, 0, 0)
		set_lights_state(0x0017, LIGHTOP_SET, 255, 0, 0)
		set_lights_state(0x0018, LIGHTOP_SET, 255, 0, 0)
		set_lights_state(0x0001, LIGHTOP_SET, 255, 0, 0)
		set_lights_state(0x0003, LIGHTOP_SET, 255, 0, 0)
		set_lights_state(0x0004, LIGHTOP_SET, 255, 0, 0)
		set_lights_state(0x0005, LIGHTOP_SET, 255, 0, 0)
		set_lights_state(0x0006, LIGHTOP_SET, 255, 0, 0)
		set_lights_state(0x0007, LIGHTOP_SET, 255, 0, 0)
		set_lights_state(0x0008, LIGHTOP_SET, 255, 0, 0)
		set_lights_state(0x0009, LIGHTOP_SET, 255, 0, 0)
		set_lights_state(0x000a, LIGHTOP_SET, 255, 0, 0)
	endloop(0x04)

	endlist
};

u8 func1023_hide_nbomb_crate[] = {
	if_savefile_flag_is_unset(GAMEFILEFLAG_G5_MINE, /*goto*/ 0x06)
	set_ailist(CHR_SELF, GAILIST_IDLE)

	label(0x06)
	disable_object(OBJ_NBOMB_CRATE)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

/**
 * Opens the laser doors in response to the stageflags changing.
 */
u8 unregistered_function[] = {
	beginloop(0x04)
		if_stage_flag_eq(STAGEFLAG_LASERSET1_DISABLED, FALSE, /*goto*/ 0x2c)
		if_door_state(OBJ_LASER_1A, (DOORSTATE_OPEN | DOORSTATE_OPENING), /*goto*/ 0x2c)
		open_door(OBJ_LASER_1A)
		open_door(OBJ_LASER_1B)
		open_door(OBJ_LASER_1C)
		open_door(OBJ_LASER_1D)
		label(0x2c)
		if_stage_flag_eq(STAGEFLAG_LASERSET2_DISABLED, FALSE, /*goto*/ 0x2c)
		if_door_state(OBJ_LASER_2A, (DOORSTATE_OPEN | DOORSTATE_OPENING), /*goto*/ 0x2c)
		open_door(OBJ_LASER_2A)
		open_door(OBJ_LASER_2B)
		open_door(OBJ_LASER_2C)
		open_door(OBJ_LASER_2D)
		label(0x2c)
		if_stage_flag_eq(STAGEFLAG_LASERSET3_DISABLED, FALSE, /*goto*/ 0x2c)
		if_door_state(OBJ_LASER_3A, (DOORSTATE_OPEN | DOORSTATE_OPENING), /*goto*/ 0x2c)
		open_door(OBJ_LASER_3A)
		open_door(OBJ_LASER_3B)
		open_door(OBJ_LASER_3C)
		open_door(OBJ_LASER_3D)
		label(0x2c)
		if_stage_flag_eq(STAGEFLAG_LASERSET4_DISABLED, FALSE, /*goto*/ 0x2c)
		if_door_state(OBJ_LASER_4A, (DOORSTATE_OPEN | DOORSTATE_OPENING), /*goto*/ 0x2c)
		open_door(OBJ_LASER_4A)
		open_door(OBJ_LASER_4B)
		open_door(OBJ_LASER_4C)
		open_door(OBJ_LASER_4D)
		label(0x2c)
	endloop(0x04)

	endlist
};

/**
 * I'm guessing co op buddies etc would get stuck in locked rooms after the
 * player has passed through them. So this just unlocks the doors once they've
 * been opened for the first time.
 */
u8 func1026_unlock_doors[] = {
	// If Velvet and counter op don't exist, return
	yield
	if_chr_death_animation_finished(CHR_COOP, /*goto*/ 0x2c)
	goto_next(0x04)
	label(0x2c)
	if_chr_death_animation_finished(CHR_ANTI, /*goto*/ 0x0a)

	// Wait until some door is not closed (so... opening, I guess?)
	beginloop(0x04)
		if_door_state(0x43, (DOORSTATE_OPEN | DOORSTATE_CLOSING | DOORSTATE_OPENING), /*goto*/ 0x2c)
		if_door_state(0x44, (DOORSTATE_OPEN | DOORSTATE_CLOSING | DOORSTATE_OPENING), /*goto*/ 0x2c)
		if_door_state(0x45, (DOORSTATE_OPEN | DOORSTATE_CLOSING | DOORSTATE_OPENING), /*goto*/ 0x2c)
		if_door_state(0x46, (DOORSTATE_OPEN | DOORSTATE_CLOSING | DOORSTATE_OPENING), /*goto*/ 0x2c)
	endloop(0x04)

	// Unlock those doors
	label(0x2c)
	unlock_door(0x43, 0x04)
	unlock_door(0x44, 0x04)
	unlock_door(0x45, 0x04)
	unlock_door(0x46, 0x04)

	// New set of doors - wait until not closed
	beginloop(0x08)
		if_door_state(0x34, (DOORSTATE_OPEN | DOORSTATE_CLOSING | DOORSTATE_OPENING), /*goto*/ 0x2c)
		if_door_state(0x35, (DOORSTATE_OPEN | DOORSTATE_CLOSING | DOORSTATE_OPENING), /*goto*/ 0x2c)
		if_door_state(0x36, (DOORSTATE_OPEN | DOORSTATE_CLOSING | DOORSTATE_OPENING), /*goto*/ 0x2c)
		if_door_state(0x37, (DOORSTATE_OPEN | DOORSTATE_CLOSING | DOORSTATE_OPENING), /*goto*/ 0x2c)
	endloop(0x08)

	// Unlock them
	label(0x2c)
	unlock_door(0x34, 0x04)
	unlock_door(0x35, 0x04)
	unlock_door(0x36, 0x04)
	unlock_door(0x37, 0x04)

	// Third set of doors
	beginloop(0x09)
		if_door_state(0x3f, (DOORSTATE_OPEN | DOORSTATE_CLOSING | DOORSTATE_OPENING), /*goto*/ 0x2c)
		if_door_state(0x40, (DOORSTATE_OPEN | DOORSTATE_CLOSING | DOORSTATE_OPENING), /*goto*/ 0x2c)
	endloop(0x09)

	label(0x2c)
	unlock_door(0x3f, 0x10)
	unlock_door(0x40, 0x10)

	label(0x0a)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func0410_invincible[] = {
	label(0x04)
	yield
	set_self_chrflag(CHRCFLAG_INVINCIBLE)
	set_self_chrflag(CHRCFLAG_UNEXPLODABLE)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func0411_hide[] = {
	label(0x04)
	yield
	set_self_chrflag(CHRCFLAG_HIDDEN)
	set_self_chrflag(CHRCFLAG_INVINCIBLE)
	set_self_chrflag(CHRCFLAG_UNEXPLODABLE)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func1027_cloak1_check_one_remaining[] = {
	// Wait until either cloak guard dying (in first room)
	beginloop(0x04)
		if_chr_dead(CHR_CLOAK_1A, /*goto*/ 0x2c)
		if_chr_death_animation_finished(CHR_CLOAK_1A, /*goto*/ 0x2c)
		if_chr_knockedout(CHR_CLOAK_1A, /*goto*/ 0x2c)
		if_chr_dead(CHR_CLOAK_1B, /*goto*/ 0x2c)
		if_chr_death_animation_finished(CHR_CLOAK_1B, /*goto*/ 0x2c)
		if_chr_knockedout(CHR_CLOAK_1B, /*goto*/ 0x2c)
	endloop(0x04)

	label(0x2c)
	set_stage_flag(STAGEFLAG_CLOAK1_ONE_REMAINING)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func1028_cloak2_check_one_remaining[] = {
	// Count number of dead cloak guards in second room
	beginloop(0x04)
		set_morale(0)
		if_chr_dead(CHR_CLOAK_2A, /*goto*/ 0x2c)
		if_chr_death_animation_finished(CHR_CLOAK_2A, /*goto*/ 0x2c)
		if_chr_knockedout(CHR_CLOAK_2A, /*goto*/ 0x2c)
		goto_next(0x06)

		label(0x2c)
		add_morale(1)
		label(0x06)
		if_chr_dead(CHR_CLOAK_2B, /*goto*/ 0x2c)
		if_chr_death_animation_finished(CHR_CLOAK_2B, /*goto*/ 0x2c)
		if_chr_knockedout(CHR_CLOAK_2B, /*goto*/ 0x2c)
		goto_next(0x06)

		label(0x2c)
		add_morale(1)
		label(0x06)
		if_chr_dead(CHR_CLOAK_2C, /*goto*/ 0x2c)
		if_chr_death_animation_finished(CHR_CLOAK_2C, /*goto*/ 0x2c)
		if_chr_knockedout(CHR_CLOAK_2C, /*goto*/ 0x2c)
		goto_next(0x06)

		label(0x2c)
		add_morale(1)
		label(0x06)
		if_chr_dead(CHR_CLOAK_2D, /*goto*/ 0x2c)
		if_chr_death_animation_finished(CHR_CLOAK_2D, /*goto*/ 0x2c)
		if_chr_knockedout(CHR_CLOAK_2D, /*goto*/ 0x2c)
		goto_next(0x06)

		label(0x2c)
		add_morale(1)
		label(0x06)
		if_morale_lt(3, /*goto*/ 0x2c)
		set_stage_flag(STAGEFLAG_CLOAK2_ONE_REMAINING)
		set_ailist(CHR_SELF, GAILIST_IDLE)
		label(0x2c)
	endloop(0x04)

	endlist
};

u8 func1029_set_secret_weapon_props[] = {
	yield
	set_object_flag3(OBJ_NBOMB_CRATE, OBJFLAG3_RTRACKED_BLUE)
	set_object_flag3(OBJ_CROSSBOW, OBJFLAG3_RTRACKED_BLUE)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func102a_8174[] = {
	// Wait until some door opening
	beginloop(0x08)
		if_door_state(0x3f, (DOORSTATE_OPEN | DOORSTATE_OPENING), /*goto*/ 0x2c)
	endloop(0x08)

	label(0x2c)
	set_chr_hiddenflag(0x07, CHRHFLAG_DONTSHOOTME)
	set_chr_hiddenflag(0x0c, CHRHFLAG_DONTSHOOTME)
	set_chr_hiddenflag(0x0d, CHRHFLAG_DONTSHOOTME)
	set_chr_hiddenflag(0x0e, CHRHFLAG_DONTSHOOTME)
	set_chr_hiddenflag(0x0f, CHRHFLAG_DONTSHOOTME)
	set_chr_hiddenflag(0x10, CHRHFLAG_DONTSHOOTME)
	set_chr_hiddenflag(0x11, CHRHFLAG_DONTSHOOTME)
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

u8 func102b_81bc[] = {
	// Wait until some door opening
	beginloop(0x08)
		if_door_state(0x3f, (DOORSTATE_OPEN | DOORSTATE_OPENING), /*goto*/ 0x2c)
	endloop(0x08)

	label(0x2c)
	set_chr_team(0x08, TEAM_ENEMY)
	set_chr_team(0x09, TEAM_ENEMY)
	set_chr_team(0x0a, TEAM_ENEMY)
	set_chr_team(0x0b, TEAM_ENEMY)
	set_chr_team(0x07, TEAM_ENEMY)
	set_chr_team(0x0c, TEAM_ENEMY)
	set_chr_team(0x0d, TEAM_ENEMY)
	set_chr_team(0x0e, TEAM_ENEMY)
	set_chr_team(0x0f, TEAM_ENEMY)
	set_chr_team(0x10, TEAM_ENEMY)
	set_chr_team(0x11, TEAM_ENEMY)
	set_chr_team(0x12, TEAM_ENEMY)
	set_chr_team(0x13, TEAM_ENEMY)
	set_chr_team(0x14, TEAM_ENEMY)
	set_chr_team(0x15, TEAM_ENEMY)
	set_chr_team(0x16, TEAM_ENEMY)
	set_chr_team(0x17, TEAM_ENEMY)
	rebuild_teams
	rebuild_squadrons
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

/**
 * I suspect Rare screwed up here. I think the lightswitch guard starts off as
 * an ally so that he won't respond to Jo making noise in the first cloak room.
 * Then when he becomes alerted to you (such as you shooting near him) he'd
 * become an enemy.
 *
 * However, it's checking if the alertness is less than, so this condition
 * passes immediately and he becomes an enemy. This could be why he's sometimes
 * left his pad by the time you leave the first room.
 */
u8 func102c_set_lightswitch_guard_team[] = {
	beginloop(0x08)
		if_chr_alertness_lt(99, CHR_LIGHTSWITCH_GUARD, /*goto*/ 0x06)
	endloop(0x08)

	label(0x06)
	set_chr_team(CHR_LIGHTSWITCH_GUARD, TEAM_ENEMY)
	rebuild_teams
	rebuild_squadrons
	set_ailist(CHR_SELF, GAILIST_IDLE)
	endlist
};

struct ailist ailists[] = {
	{ func0401_init_swat1,                 0x0401 },
	{ func0402_init_swat2,                 0x0402 },
	{ func0403_walk_from_meeting,          0x0403 },
	{ func0404_run_from_meeting,           0x0404 },
	{ func0405_cloak2_hide,                0x0405 },
	{ func0406_init_type1_guard,           0x0406 },
	{ func0407_init_type2_guard,           0x0407 },
	{ func0408_init_cloak1_guard,          0x0408 },
	{ func0409_start_path00,               0x0409 },
	{ func040a_start_path01,               0x040a },
	{ func040b_start_path02,               0x040b },
	{ func040c_start_path03,               0x040c },
	{ func1400_setup_counterop,            0x1400 },
	{ func1001_objectives_failed_msg,      0x1001 },
	{ func1002_set_ai,                     0x1002 },
	{ func1003_laser_switch_1,             0x1003 },
	{ func1004_laser_switch_2,             0x1004 },
	{ func1005_laser_switch_3,             0x1005 },
	{ func1006_laser_switch_4,             0x1006 },
	{ func1007_init_lasers,                0x1007 },
	{ func1008_check_generator,            0x1008 },
	{ func1009_spawner_during_decode,      0x1009 },
	{ func100a_give_keycards,              0x100a },
	{ func100b_check_backup_collected,     0x100b },
	{ func100c_check_for_meeting_trigger,  0x100c },
	{ func100e_check_conspirators_alerted, 0x100e },
	{ func100f_alarm_switches,             0x100f },
	{ func1010_safe_cracking,              0x1010 },
	{ func1012_check_for_end,              0x1012 },
	{ func1013_check_escape_doors,         0x1013 },
	{ func1014_check_camspy_location,      0x1014 },
	{ func1017_check_lasers_closed,        0x1017 },
	{ func1018_intro_from_menu,            0x1018 },
	{ func1019_generator_hum,              0x1019 },
	{ func101a_init_laser_switch_guards,   0x101a },
	{ func101b_cloak2_entry,               0x101b },
	{ func101c_check_visited_top_door,     0x101c },
	{ func101d_init_mines,                 0x101d },
	{ func101e_msg_nowaythrough,           0x101e },
	{ func101f_msg_meetingroomahead,       0x101f },
	{ func1020_msg_heavilyencrypted,       0x1020 },
	{ func1021_blow_mines,                 0x1021 },
	{ func1022_light_switch,               0x1022 },
	{ func1023_hide_nbomb_crate,           0x1023 },
	{ func1026_unlock_doors,               0x1026 },
	{ func1027_cloak1_check_one_remaining, 0x1027 },
	{ func1028_cloak2_check_one_remaining, 0x1028 },
	{ func1029_set_secret_weapon_props,    0x1029 },
	{ func102a_8174,                       0x102a },
	{ func102b_81bc,                       0x102b },
	{ func102c_set_lightswitch_guard_team, 0x102c },
	{ func040d_intro,                      0x040d },
	{ func040e_meeting_cutscene,           0x040e },
	{ func040f_outro,                      0x040f },
	{ func0410_invincible,                 0x0410 },
	{ func0411_hide,                       0x0411 },
	{ func0412_cloak_guard,                0x0412 },
	{ func0413_cloak1_guard,               0x0413 },
	{ func0414_init_cloak2_guard,          0x0414 },
	{ func1018_intro_from_menu,            0x0c00 },
	{ func040e_meeting_cutscene,           0x0c01 },
	{ func040f_outro_from_menu,            0x0c02 },
	{ NULL, 0 },
};

struct path paths[] = {
	{ path00, 0, PATHFLAG_CIRCULAR },
	{ path01, 1, PATHFLAG_CIRCULAR },
	{ path02, 2, PATHFLAG_CIRCULAR },
	{ path03, 3, PATHFLAG_CIRCULAR },
	{ NULL, 0, 0 },
};
